On 12-05-31 01:23 PM, Jon Forsyth wrote:
Hello,
I'm using the following line in Terminal, on OSX Lion, but I can't seem to
match parentheses '()':
perl -n -e 'print if(/\\(Submit\\)/)' visits/admin_add.ctp
I tried with one backslash in front of each '(' ')' as well to no avail.
If I remove the '\'s and '()' the match is printed like so:
<?php echo $form->end('Submit');?>
My purpose is to make sure I'm matching the correct lines including the
'()', then to alter the code to perform a search and replace on the
matches). Something like:
perl -p -i.bak -e 's/PATTERN/REPLACE/g' INPUT
Thanks!
Mine works with one backslash:
$ perl -n -e 'print"\t$_" if(/\(Submit\)/)'
Submit
(Submit)
(Submit)
This is a test Submit will not repeat
This is a test (Submit) will repeat
This is a test (Submit) will repeat
^D
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
_Perl links_
official site : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help : http://perlmonks.org/
documentation : http://perldoc.perl.org/
news : http://perlsphere.net/
repository : http://www.cpan.org/
blog : http://blogs.perl.org/
regional groups : http://www.pm.org/
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/