Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 04 Sep 2004 01:53:08 +0200
From:      Alex de Kruijff <freebsd@akruijff.dds.nl>
To:        jd <web@3dresearch.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: String replacement with sed
Message-ID:  <20040903235308.GA1834@alex.lan>
In-Reply-To: <20040903233708.B45BD328AD@smtp.3dresearch.com>
References:  <20040903233708.B45BD328AD@smtp.3dresearch.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040903235308.GA1834>