[ale] SED
Wandered Inn
esoteric at denali.atlnet.com
Tue Nov 30 16:57:27 EST 1999
Thorsten Hofrichter wrote:
>
> HAve a sed question.
> I have been trying to figure this out for a few minutes now
> how do I substitute a character for a new line
> example a file that contains a,b,c,d
> I need it to output
> a
> b
> c
> d
> I need to use sed for this and have tried doing
> cat filename | sed s/,/\\n/g
> I have read man pages but dont understant why that would not work
> Any ideas??
> Thanks in advance
Not sure why you HAVE to use sed, but this works for me:
sed 's/,/\^J/g' filename
seems to me, awk would be a better tool:
awk '{for (i=1; i<=NF;i++) { printf "%s\n", $i}}' filename
>
> ____________________________________________
> Thorsten Hofrichter
> AIX System Administrator
> IKON Data Center
> Macon, GA 31210
> 1-800-800-1060 x 3669
> (912) 471-2301 x 3669
> (912( 471-6768 (HOME)
> thofrichter at ikon.com
> thholr at alef.gcsu.edu
> ____________________________________________
--
Until later: Geoffrey esoteric at denali.atlnet.com
It should be illegal to yell "Y2K" in a crowded economy.
-- Larry Wall, creator of the programming language Perl
More information about the Ale
mailing list