From owner-freebsd-questions Sat Apr 15 12:18:20 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 514E537B5A7 for ; Sat, 15 Apr 2000 12:18:07 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id OAA00732; Sat, 15 Apr 2000 14:17:22 -0500 (CDT) (envelope-from dan) Date: Sat, 15 Apr 2000 14:17:21 -0500 From: Dan Nelson To: Grigory Kljuchnikov Cc: Arcady Genkin , freebsd-questions@FreeBSD.ORG Subject: Re: A sed question Message-ID: <20000415141721.B29750@dan.emsphone.com> References: <878zygz9z0.fsf@tea.thpoon.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.1.9i In-Reply-To: ; from "Grigory Kljuchnikov" on Sat Apr 15 11:03:56 GMT 2000 X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Apr 15), Grigory Kljuchnikov said: > On 14 Apr 2000, Arcady Genkin wrote: > > Dan Nelson writes: > > > 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 > > > > There is only one command per line in sed or several commands > per line with -e option. After a bit more reading of the manpage, you can actually do what you want. There is only one *command* per line, but each command can have several *functions*, and 's' is a function. You can use a function-list by separating them with newlines and putting { } around the whole thing. so sed -e '/^Subject: /{ s/\[PHP3\] *//g s/\[PHP4BETA] *//g }' will do what you want. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message