On Thu, Dec 11, 2003 at 11:21:39AM -0500, Jeff 'japhy' Pinyan wrote: >On Dec 11, George Georgalis said: > >>On Thu, Dec 11, 2003 at 09:05:20AM -0500, Jeff 'japhy' Pinyan wrote: >>>On Dec 10, George Georgalis said: >>> >>>>giving my perl a retry, I found some hints on a website to recursively >>>>replace text >>>> >>>>perl -p -i -e 's/old\(.\)atext/new\1btext/g;' $( find ./ -name '*.html' -o -name >>>>'*.txt' ) >>> >>>This isn't recursively replacing text; it's recursively going through a >>>directory tree. >>> >>>>but from what I can tell, perl doesn't support the \1 for \(*\) symbols >>>>like sed does. What is the work around? >>> >>>Because Perl is not sed. Perl uses (...), not \(...\) for its memory >>>capturing. In Perl's regexes, all non-alphanumeric metacharacters don't >>>use backslashes. That means [...] for character classes, not \[...\], and >>>+ for " 1 or more", not \+, and so on. >> >>that's what I needed to hear... however replacing text (with memory >>capturing) is still a problem: >> >>perl -p -i -e 's/451(.)8229/331\12027/g;' $( find ./ -type f -name '*.html' -o -name >>'*.txt' ) > >Right; first of all, \1 should only be used IN the regex ITSELF. Outside >of the regex, you should use $1. However, "331$12027" still isn't >appropriate; you'll need "331${1}2027". The reason "331\12027" gave you >"331P27" is because octal character 120 is "P".
Thanks, perl -p -i -e 's/347(.)451(.)8229/646${1}331${2}2027/g;' $( find ./ -type f -name '*.html' -o -name '*.txt' ) perl -p -i -e 's/347(..)451(.)8229/646${1}331${2}2027/g;' $( find ./ -type f -name '*.html' -o -name '*.txt' ) worked perfect to update my web pages... :) btw - what's the best manpage for the perl command line options? TAI, // George -- GEORGE GEORGALIS, System Admin/Architect cell: 646-331-2027 <IXOYE>< Security Services, Web, Mail, mailto:[EMAIL PROTECTED] Multimedia, DB, DNS and Metrics. http://www.galis.org/george -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>