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 
colon, def 
Replace that with $var, a colon, *whatever was in "some stuff"*, a colon , 456, a 
colon, ghi

It seems like that parens and \1 combo ought to do it but I can't get that to work!
The file does get modified so I have permission it's just that \1 is empty on the 
result and has data before I run the command.

And no I'm not messing with /ets/passwd files :)

I'm runing Perl 5.8 on redhat 9 if that makes a difference. 

TIA

Dan


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to