I'm trying to use AWK to place every word within a text document on a new line. I don't really know how to use AWK but I've found some commands online which should solve my problem. I've tried the following commands:
$ awk '{ for (i = 1; i <= NF; i++) print $i }' input.txt > output.txt
and
$ awk '{c=split($0, s); for(n=1; n<=c; ++n) print s[n] }' input.txt > output.txt
However, both of these commands have the same effect, which is that all spaces are removed.
For clarity, lets say that input.txt contains the text:
The fox jumped over the dog
output.txt should contain:
The
fox
jumped
over
the
dog
However output.txt contains:
Thefoxjumpedoverthedog
I'm using Cygwin on Windows 7 to use these commands. Is there something I'm missing within the commands?