I would like to convert a text file containing words, space separate to a file where each word appears on a separate line
sdf sdfsd= sdfsdf
sdfsdf
will become
sdf
sdfsd=
sdfsdf
sdfsdf
thanks
I would like to convert a text file containing words, space separate to a file where each word appears on a separate line
sdf sdfsd= sdfsdf
sdfsdf
will become
sdf
sdfsd=
sdfsdf
sdfsdf
thanks
enter the following command:
:%s/ /\r/g
or whatever the carriage return is for your environment. \r for *nix, \n for windows.
Try this:
:%s/\s\+/\r/g
Explained:
:% // whole file
s // substitute
\s\+ // some number of whitespace characters
\r // for carriage return
Thanks to @Dummy00001 for the +
idea.
This is also easy to write as a shell script, you don't need sed
or awk
:
bash$ for word in $(cat input.txt); do echo "$word" >> output.txt; done