[Ilugc] RE: ilugc Digest

  • From: knutties@xxxxxxxxx (Natarajan K)
  • Date: Wed Jul 13 14:19:31 2005

On 7/13/05, Ramkumar R <andyetitmoves@xxxxxxxxx> wrote:

  "recursive search a string inside folders & subfolders till the end  & to 
replace that string"

find <folder> -type f -print0 | xargs -0 ./replacefile s/<search
pattern>/<replacement>/

Perl has in built in place text replacement facility:

$ find <folder> -type f -print0 | \
xargs perl -pi -e 's/<find>/<replace>/g'

If you need a backup of the files with name .bak use
$ find <folder> -type f -print0 | \
xargs perl -pi.bak -e 's/<find>/<replace>/g'


HTH,
Natarajan
-- 
http://puggy.symonds.net/~natarajan

Other related posts: