In Linux you can do this to put comma separated data on its own line like this.
sed 's/[,.!?] */&\n/g' /tmp/ports
sed 's/[,.!?] */\n/g' /tmp/ports
How do you do this in AIX? It is not working. Is there another way to do this? Something like this.
1, 2, 3, 4
To look like this.
1
2
3
4
Neo
2
What is your output when you attempt this in AIX?
Please post your sample output (even when wrong) and any error messages.
Thanks.
Sorry about that. Here it is.
>sed 's/[,.!?] */&\n/g' /tmp/ports
1, n2, n3, n4
>sed 's/[,.!?] */\n/g' /tmp/ports
1n2n3n4
\n being a newline is specific to GNU sed.
Put a \newline
sed 's/[,.!?] */&\
/g' /tmp/ports
sed 's/[,.!?] */\
/g' /tmp/ports
The
'two
lines'
string work in all Bourne/Posix compatible shells. The GNU extension also supports csh and tcsh shells.
1 Like
RudiC
5
Try also
tr -s ', ' $'\n' < file
1
2
3
4
1 Like