Re: best way to replace text in a lot of files?



John, is there a way to change the "/" delimiter, since the forward slash is part of my "edit"? Thanks!

John Dunn <JDunn@xxxxxxxxx> 5/31/2007 8:14:06 am >>>

find mydirectory -name "*.*" -print | xargs perl -pi.bak -e
's/oldstring/newstring/g'


This also creates a .bak version of any file it changes


John




-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@xxxxxxxxxxxxx] On Behalf Of
Tim Brumfield
Sent: 31 May 2007 14:09
To: aix-l@xxxxxxxxxxxxx
Subject: best way to replace text in a lot of files?

I need to change a path in a lot of text files. Does anyone have a shell
script to do something like this? As an example, I would be changing
"/dbadmin/test/financial/scripts" to "/financial/scripts". I have
hundreds of files to change. I am running aix5.3. Thanks in advance!



-tim


wise man say:
wife who often send man to doghouse may one day find him in cathouse...