Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Dec 2004 21:03:40 -0500
From:      Parv <parv@pair.com>
To:        antenneX <antennex@swbell.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Find & Replace string
Message-ID:  <20041211020340.GA568@moo.holy.cow>
In-Reply-To: <019101c4de0e$dbdeb2d0$0200000a@SAGEAME>
References:  <019101c4de0e$dbdeb2d0$0200000a@SAGEAME>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <019101c4de0e$dbdeb2d0$0200000a@SAGEAME>,
wrote antenneX thusly...
>
> In a website of 1.GB+ with several hundred thousand files, I need
> to interrogate all files to replace a single string like
> "oldone.010" with "newone.011"
> 
> What's the best way to do this?

Find yourself if the following is the best way ...

  fgrep -r -l 'oldone.010'  parent-directory-of-files \
  | xargs perl -pi -e 's[oldone\.010]/newone.011/g'


  - Parv

-- 



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