From owner-freebsd-questions@FreeBSD.ORG Fri Sep 3 23:53:10 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE24F16A4FD for ; Fri, 3 Sep 2004 23:53:10 +0000 (GMT) Received: from smtp18.wxs.nl (smtp18.wxs.nl [195.121.6.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4445543D49 for ; Fri, 3 Sep 2004 23:53:10 +0000 (GMT) (envelope-from freebsd@akruijff.dds.nl) Received: from kruij557.speed.planet.nl (ipd50a97ba.speed.planet.nl [213.10.151.186]) by smtp18.wxs.nl (iPlanet Messaging Server 5.2 HotFix 1.25 (built Mar 3 2004)) with ESMTP id <0I3H00FPSP0K4D@smtp18.wxs.nl> for freebsd-questions@freebsd.org; Sat, 04 Sep 2004 01:53:09 +0200 (CEST) Received: from alex.lan (localhost [127.0.0.1]) by kruij557.speed.planet.nl (8.12.10/8.12.10) with ESMTP id i83Nr8NI002056; Sat, 04 Sep 2004 01:53:08 +0200 Received: (from root@localhost) by alex.lan (8.12.10/8.12.10/Submit) id i83Nr884002055; Sat, 04 Sep 2004 01:53:08 +0200 Content-return: prohibited Date: Sat, 04 Sep 2004 01:53:08 +0200 From: Alex de Kruijff In-reply-to: <20040903233708.B45BD328AD@smtp.3dresearch.com> To: jd Message-id: <20040903235308.GA1834@alex.lan> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.4.2.1i References: <20040903233708.B45BD328AD@smtp.3dresearch.com> cc: freebsd-questions@freebsd.org Subject: Re: String replacement with sed X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2004 23:53:11 -0000 On Fri, Sep 03, 2004 at 07:37:08PM -0400, jd wrote: > > I need to change a bunch of Analog config files; among other things > change the location of IMAGEDIR. I made this simple script: > > #!/bin/sh > for loop in `ls analog/*` > do > > sed -e > '/IMAGEDIR/s/www2.3dresearch.com\/analog_images\//fiordiligi.3dresearch.com\/images\//p' > $loop > $loop.sed > > done > > It works fine, except I get duplicate lines, such as: > > IMAGEDIR http://fiordiligi.3dresearch.com/images/ > IMAGEDIR http://fiordiligi.3dresearch.com/images/ > > I want just a single line - what do I need to change? > > Thank you for your insight... You can do this with uniq. I don't now this command so I have to refere you to 'man uniq'. -- Alex