[wellylug] perl recursive text search and replace
andrej at paradise.net.nz
andrej at paradise.net.nz
Fri Aug 20 10:40:56 NZST 2004
Quoting Mark Signal <mark at databackup.co.nz>:
> this will replace text within a nominated directory
>
> perl -w -pi -e "s/oldinfo/newinfo/g;" targetdir/targetfile
I don't know of a perl-way of doing this, but I'd do
find <targetdir/targetfile> -exec perl -w -pi -e "s/oldinfo/newinfo/g;" {} \;
<> = (appropriate options for file and/or dir)
Cheers,
Andrej
More information about the wellylug
mailing list