[plug] Help..how do I match /usr/local but not ./usr/local ?

Ryan ryan at is.as.geeky.as
Fri Feb 27 11:23:54 WST 2004


On Fri, 2004-02-27 at 11:14, Lawrie Abbott wrote:
> Hi Pluggers,
> I  can do
> 
> sed -i -e 's|/usr/local|/usr|g' filename
> 
> but there are instances in one of the files that  contains instances of 
> "./usr/local" that I want left untouched.
> I have been looking through sed info and cant find a way to do it (that 
> my feeble brain can cope with). Can anyone enlighten me?  Perl?

's|^/usr/local/|/usr|g'

the ^ will start matching from the beginning of the line, so the the ./
will fail the match.

Ryan




More information about the plug mailing list