I have a file with a single line in it as below.
field1 field2 field3
Different fields separated by spaces. I need the output as below.
field1
field2
field3
Any sed/awk solution you can suggest?
I have a file with a single line in it as below.
field1 field2 field3
Different fields separated by spaces. I need the output as below.
field1
field2
field3
Any sed/awk solution you can suggest?
cat <filename> | sed 's/ /\n/g'
The output of sed 's/ /\n/g' is like below.
field1nfield2nfield3
I'm working in AIX. ksh is the shell.
Try:
tr " " "\n"
Regards
tr works. But I'm trying to see if there are other solutions, especially sed.
Why is the sed 's/ /\n/g' not working for me?
This depends on the sed you are using, with the traditional seds you can't do that.
You can achieve this as follow (in 2 lines!):
sed 's/ /\
/g'
Regards