I have a file where character are in the type abcd abcd abcd abcd
but my client wants them in the format as
abcd
abcd
abcd
abcd
I have a file where character are in the type abcd abcd abcd abcd
but my client wants them in the format as
abcd
abcd
abcd
abcd
Use the tr
command to replace spaces with newlines.
tr ' ' '\n' < file.txt > newfile.txt
If the delimeter is just a space the following command should work:
sed 's/[[:space:]]/\n/g' infilename > outfilename
otherwise use [[:blank:]] to also includ tabs, form feeds, newlines and carriage returens
If there are more spaces/blanks between the words, just use an asterix behind the [[:space:]] :
sed 's/[[:space:]]*/\n/g' infilename > outfilename
sed 's/[[:blank:]]/\n/g' file
– RomanPerekhrest Jun 08 '17 at 15:24tr
for this: `tr ' ' '\n' < filename – JayJay Jun 08 '17 at 15:25