I'm currently using the following to split a file into words - Is there some quicker way?
while read -r line
do
for word in $line
do
words="${words}\n${word}"
done
done
I'm currently using the following to split a file into words - Is there some quicker way?
while read -r line
do
for word in $line
do
words="${words}\n${word}"
done
done
What about using tr?
tr -s [:space:] \n < myfile.txt
The -s
squeezes multiple whitespace characters into one. You might need to escape some things to execute it.