> qx interpolates variables. by the time $1 gets to perl, it's
> already gone.
> try:
>
> print qx(perl -pi -e 's/^$u:hello:([^:]*):/$u:goodbye:\$1/;' file);
>
That did it! Thanks a million for pointing that out!
> why not simply:
>
> [panda]$ perl -pi -e
> 's/^datax:hello:([^:]*):/datax:go
Dan Muey wrote:
>> First, (.*) is very greedy. You might want to limit it in
>> some way, possibly with a ? modifier like (.*?), possibly by
>> looking for less than . such as ([^:]*) -- anything but a colon.
>>
>> Second, the backwack numbers \1 .. \9 are only for the
>> matching portion of a s
> First, (.*) is very greedy. You might want to limit it in
> some way, possibly with a ? modifier like (.*?), possibly by
> looking for less than . such as ([^:]*) -- anything but a colon.
>
> Second, the backwack numbers \1 .. \9 are only for the
> matching portion of a subsitution. You mus
It was Wednesday, October 08, 2003 when Dan Muey took the soap box, saying:
: Howdy list:
:
: Trying to do an inplace edit:
:
: perl -pi -e 's/whatever/newstuff/;' /file/path/here
:
: What I need to do is replace certain parts of the line for instance:
:
:
: s/^$var:(.*):123:def/$var:\1:456:g
Howdy list:
Trying to do an inplace edit:
perl -pi -e 's/whatever/newstuff/;' /file/path/here
What I need to do is replace certain parts of the line for instance:
s/^$var:(.*):123:def/$var:\1:456:ghi/;
Soo if a line matches the $var at the beginning a colon, some stuff, a colon, 123, a
colo