[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Multible search and replace?



> This is especially nifty because "from" may be a perl regular expression
> (including parentheses pairs enclosing substrings of itself) and "to"
> may include $1, $2... refernces to such pairs- very handy.

Well, not with the example I gave you can't, but if you use something like
this, you can use all those wonderful perl regexp tricks:

#!/usr/bin/perl -i.bak
$find=shift; $replace=shift;
while (<>) { eval "s/$find/$replace/g"; print }

-- 
               "true - do nothing, successfully" - - true (1)


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: