[olug] Text search and Replace

Brian Roberson roberson at olug.org
Tue Nov 25 16:45:08 UTC 2003


cd /some/directory
for i in * ; do
sed -e 's/somestring/otherstring/g' $i > $i.tmp
mv -f $i.n $i
done


or recursive:

cd /some/directory
for i in `find /some/directory type -f ` ; do
sed -e 's/somestring/otherstring/g' $i > `basename $i`.tmp
mv -f  `basename $i`.tmp $i
done





----- Original Message ----- 
From: "Jeff Norton" <jnorton at jggt.com>
To: <OLUG at olug.org>
Sent: Tuesday, November 25, 2003 9:54 AM
Subject: [olug] Text search and Replace


> I want to search a directory on my computer and replace certain text
> within documents with a new text.
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 


More information about the OLUG mailing list