anna_black has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I need to do a simple command line substitution of a string, but I'm obviously making some mistake, as it doesn't work:
> echo "Hello Dolly" | perl -lpe "s/l(lo)/$1/" He Dolly
I'm probably missing something completely silly, but I can't understand why the $1 doesn't capture the lo in the parentheses... (I want the output to be Helo Dolly)
Thanks a lot!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex capturing
by FunkyMonk (Bishop) on Apr 06, 2009 at 12:00 UTC | |
|
Re: Regex capturing
by manoj_speed (Prior) on Apr 06, 2009 at 13:21 UTC | |
|
Re: Regex capturing
by Grey Fox (Chaplain) on Apr 06, 2009 at 14:36 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |