Date: Sat, 15 Apr 2000 11:03:56 +0400 (MSK) From: Grigory Kljuchnikov <grn@ispras.ru> To: Arcady Genkin <a.genkin@utoronto.ca> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: A sed question Message-ID: <Pine.GSO.4.20.0004151047370.27653-100000@gate.ispras.ru> In-Reply-To: <878zygz9z0.fsf@tea.thpoon.com>
next in thread | previous in thread | raw e-mail | index | archive | help
There is only one command per line in sed or several commands per line with -e option. Best regards, Grigory Klyuchnikov ------------------------------------------------------------ Institute for System Programming Russian Academy of Sciences, 109004, Moscow, Russia, B.Kommunistitcheskay, 25, phone(work): +7-095-9125659 fax: +7-095-9121524 e-mail: <grn@ispras.ru> On 14 Apr 2000, Arcady Genkin wrote: > Dan Nelson <dnelson@emsphone.com> writes: > > > > Can I specify *two* commands per line? > > > > Sure; to specify more than one command, you need to pass them with the > > -e flag: > > sed -e 's/etc/etc/' -e 's/etc/etc/' > > Oh, sorry, I meant something else. I meant two commands per _matched_ > line, not per command line. Something like: > > sed '/^Subject: / s/\[PHP3\] *//g s/\[PHP4BETA] *//g' > ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ > Command 1 Command 2 > > i.e. process every line that matches /^Subject:/, first removing any > occurences of [PHP3], then -- any occurences of [PHP4BETA]. > > The above examble gives me an error message about unknown option to > 's'. > -- > Arcady Genkin http://www.thpoon.com > Nostalgia isn't what it used to be. > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > 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?Pine.GSO.4.20.0004151047370.27653-100000>