Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Nov 2002 13:12:18 -0800
From:      "Paul A. Scott" <pscott@skycoast.us>
To:        Mathew Kanner <mat@cnd.mcgill.ca>, <freebsd-questions@freebsd.org>
Subject:   Re: stupid sed question
Message-ID:  <B9F01732.F3A4%pscott@skycoast.us>
In-Reply-To: <20021107154625.A92742@cnd.mcgill.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/7/02 12:46 PM, "Mathew Kanner" <mat@cnd.mcgill.ca> wrote:
> What I would like is
> echo abc | sed -e's,b,\n'  to get
> a
> c

A script of the form:

echo abc | sed -e 's,b,\
,'

will work if the newline is escaped with a backslash and the remainder of
the sed substitute is on the next line.

If you run directly from the command line (not in a shell script) then you
need two backslashes, the first one escapes the backslash for the
interactive shell.

Paul A. Scott
mailto:pscott@skycoast.us
http://skycoast.us/pscott/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B9F01732.F3A4%pscott>