need help with a sed script

der.hans PLUGd at LuftHans.com
Wed May 3 03:09:00 MST 2006


Am 02. May, 2006 schwätzte Kevin Brown so:

>> 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'
>> 
>> Can someone help please?
>
> find . -name 'somefile' | xargs perl -ne 's/England/Aubrey/'

Shouldn't that be a p rather than a n?

One can also use i to make a backup copy

perl -pi.orig 's/England/Aubrey/'

That allows Nathan to go back and make sure he didn't accidentally rename
some country or someone else named England.

ciao,

der.hans
-- 
#  https://www.LuftHans.com/        http://www.CiscoLearning.org/
#  Join the League of Professional System Administrators! https://LOPSA.org/
#  To announce that there must be no criticism of the President, or that we
#  are to stand by the President, right or wrong, is not only unpatriotic
#  and servile, but is morally treasonable to the American public.
#  -- Theodore Roosevelt, editorial in the Kansas City Star, 07May1918


More information about the PLUG-discuss mailing list