-1

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
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

2 Answers2

1

Use the tr command to replace spaces with newlines.

tr ' ' '\n' < file.txt > newfile.txt
Barmar
  • 9,927
0

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
Hartmut
  • 199