[Ilugc] RE: ilugc Digest

  • From: andyetitmoves@xxxxxxxxx (Ramkumar R)
  • Date: Wed Jul 13 12:58:15 2005

  "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>/

replacefile:

#!/bin/sh

TEMP=`mktemp -t replacefile.XXXXXX` || exit 1
PAT="$1"
shift

for i in "$@"; do
  sed -e $PAT < "$i" > $TEMP && mv $TEMP "$i"
done

# replacefile ends here

it moves on...

-- 
The day Microsoft makes something that doesn't suck
is probably the day they start making vacuum cleaners.
                                               -Ernst Jan Plugge

Other related posts: