Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
30: 400 650 710
I have a one-liner that removes the number before the colon and substitutes any following number with this removed number.
Here is the one liner:
I run on Solaris9 and here is what I get (the desired result):perl -p -e 's/^([0-9]+)://g;$a=$1;s/\d+/$a/g' $CONF_FILE
30 30 30
On RHAS I get nothing returned. From intial debugging it appears the number before the colon is removed but not captured.
I say this because I try this modified one-liner to print the captured result:
On SUN I see the value printed (before the returned line of course):perl -p -e 's/^([0-9]+)://g;print $1' $CONF_FILE
30 400 650 710
But on Linux I do not see the captured value:
400 650 710
I need this to be portable - if anyone would be gracious enough to bestow any ideas upon me I would appreciate it very much!
Edited by planetscape - added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: One Liner works on SUN but not on Linux??
by samtregar (Abbot) on Nov 07, 2005 at 18:00 UTC | |
|
Re: One Liner works on SUN but not on Linux??
by Perl Mouse (Chaplain) on Nov 07, 2005 at 17:24 UTC | |
|
Re: One Liner works on SUN but not on Linux??
by jasonk (Parson) on Nov 07, 2005 at 17:28 UTC | |
|
Re: One Liner works on SUN but not on Linux??
by sauoq (Abbot) on Nov 07, 2005 at 17:27 UTC |