From owner-freebsd-questions@FreeBSD.ORG Tue Sep 25 17:42:03 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 538EA16A417 for ; Tue, 25 Sep 2007 17:42:03 +0000 (UTC) (envelope-from nvass@teledomenet.gr) Received: from smtp.teledomenet.gr (smtp.teledomenet.gr [213.142.128.2]) by mx1.freebsd.org (Postfix) with ESMTP id DEC4F13C469 for ; Tue, 25 Sep 2007 17:42:02 +0000 (UTC) (envelope-from nvass@teledomenet.gr) Received: by smtp.teledomenet.gr (Postfix, from userid 58) id 9D85214212E; Tue, 25 Sep 2007 20:42:01 +0300 (EEST) X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on smtp.teledomenet.gr X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RDNS_NONE autolearn=no version=3.2.3 Received: from iris (unknown [192.168.1.71]) by smtp.teledomenet.gr (Postfix) with ESMTP id 377631420D3; Tue, 25 Sep 2007 20:41:57 +0300 (EEST) From: Nikos Vassiliadis To: Gary Kline Date: Tue, 25 Sep 2007 20:38:50 +0300 User-Agent: KMail/1.9.1 References: <20070925013723.GA50027@thought.org> <200709250931.05367.nvass@teledomenet.gr> <20070925165844.GD50519@thought.org> In-Reply-To: <20070925165844.GD50519@thought.org> X-NCC-RegID: gr.telehouse MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200709252038.50704.nvass@teledomenet.gr> Cc: freebsd-questions@freebsd.org Subject: Re: sed question... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2007 17:42:03 -0000 On Tuesday 25 September 2007 19:58, Gary Kline wrote: > But trying to parse this from man sed is more than > difficule. And I have yet to find "ba" in the man page. That is > why I asked for some insights rather that to be told to "go read > the man page"; to me, that's dismissing the issue rather than > addressing it. Hm, my suggestion was wrong... sed is a bit cryptic to learn from the manual page. The manual can be used as a reference, if you alread know sed. So, ba is: branch to the a label for example: my_label: ... bmy_label My points are: If you want to learn sed, you have to invest some time. If you want to ask for an one-liner that does what you want, that's fine too. sed isn't only s/foo/bar/. There is a dc(1) clone in sed, which is at least an amazing accomplishment for sed. You might want (or not) to learn more things about it. > Right. I always do a perl -pi.bak [...] mostly out of habit. > With sed, redirection saved the new output, leaving the original > in ``.'' FWIW, I was using the sed on my Ubuntu server. It is > different from the BSD sed that I've used now/then since 1978. I think this version of sed is different too, since it's part of BSD since 4.4BSD. It may be compatible with the older BSD one. The in-place replacement is a non-standard extension which both BSD and GNU sed share. Cheers Nikos