need help with a sed script

Jerry Davis jdawgaz at cox.net
Tue May 2 21:14:35 MST 2006


On Tue, 2 May 2006 20:55:23 -0700
Nathan England <nathan at paysonlinux.org> wrote:

> 
> I absolutely just do not understand sed...
> I have a ton of files and scripts I've collected over the years.
> Through the course of time I was adopted and my name was changed, now
> I am changing it back to my original name and I want to change my nme
> in all my scripts... this is lame and tedious no doubt, but something
> for fun.
> 
> All my scripts are located in a series of folders contained under my
> Documents folder. Basically, I need to find every file that contains
> the word 'England' and  replace it with 'Aubrey'

try this:

BE SURE TO MAKE A BACKUP copy of your Documents directory first.
Then do:

cd ~/Documents
grep -R England | cut -d: -f1 | while read f; do
  sed 's/England/Aubrey/g' "$f" > "$f.temp"
  cp -f "$f.temp" "$f"
done

  

> 
> Can someone help please?
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


-- 
Hobbit Name: Pimpernel Loamsdown
Registered Linux User: 275424
 
This email's random fortune: "We Americans, we're a simple people...
but piss us off, and we'll bomb 
your cities."
-- Robin Williams, _Good Morning Vietnam_


More information about the PLUG-discuss mailing list