convert space into new line using sed command
In this sed command trick we will learn how to convert space into new line.For more understanding we will take an example. In file called test we have written colour names with spaces.Now we will convert the space into new line.
Syntax:
sed 's/s/n/g' file_name
example is given below
linux@tuxworld:/tmp$ cat test red blue green yellow orange white black violet maroon brown color linux@tuxworld:/tmp$ linux@tuxworld:/tmp$ sed 's/s/n/g' test red blue green yellow orange white black violet maroon brown color linux@tuxworld:/tmp$
may require preceeding s and n with backslashes
sed ‘s/\s/\n/g’ test