[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] SED
- Subject: [ale] SED
- From: ivey at gweezlebur.com (michael d. ivey)
- Date: Tue, 30 Nov 1999 22:00:35 +0000
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