[ale] SED
michael d. ivey
ivey at gweezlebur.com
Tue Nov 30 17:00:35 EST 1999
On Tue, Nov 30, 1999 at 04:30:53PM -0500, 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??
$ cat filename | sed -e 's/,/\
/'
yes, that is a \ followed by a literal <newline>. from my sed
manpage:
This version of sed supports a \<newline> sequence in all
regular expressions, the replacement part of a substitute (s)
command, and in the source and dest parts of a
transliterate (y) command. The \ is stripped, and the
newline is kept.
YMMV.
--
-- michael d. ivey, chief thinker --- <ivey at gweezlebur.com> -----------
------ gweezle bur poetry manufacturing <http://gweezlebur.com> -------
------------------------------------------------------------------------
"Moderation is a fatal thing. Nothing succeeds like excess." -- Wilde
More information about the Ale
mailing list