[wellylug] perl recursive text search and replace

Mark Signal mark at databackup.co.nz
Fri Aug 20 11:18:00 NZST 2004


well this is what finally worked...

find html/ -type f  -iname *.htm* -exec perl -pi -e "s/oldinfo/new info/g;"
'{}' ';'

thanks for the help guys

cheers

Mark

-----Original Message-----
From: wellylug-admin at lists.naos.co.nz
[mailto:wellylug-admin at lists.naos.co.nz]On Behalf Of Mark Signal
Sent: Friday, 20 August 2004 10:10 a.m.
To: Wellylug
Subject: [wellylug] perl recursive text search and replace


I could use a little help here....

this will replace text within a nominated directory

perl -w -pi -e "s/oldinfo/newinfo/g;" targetdir/targetfile

how do I alter it to include all subdirectories?

cheers

Mark


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004


--
Wellington Linux Users Group Mailing List: wellylug at lists.naos.co.nz
To Leave:  http://lists.naos.co.nz/mailman/listinfo/wellylug

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004




More information about the wellylug mailing list