On Thu, Jan 15, 2009 at 3:18 PM, Michael B. Smith
<[email protected]> wrote:
> PowerShell
> Or awk. Or sed.
Yup. Or Perl. Perl has a handy flag that will handle the
copy/rename/delete dance for you. The following will replace "foo"
with "bar" in all text files in the current directory,
case-insensitive:
perl -i -p -e "s/foo/bar/gi" *.txt
-i = edit in-place
-p = assume an input/print loop for all specified files
-e = evaluate command line as program
s/ = substitute
/g = global substitution (all matches on line, not just first)
/i = case-insensitive search
-- Ben
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~