in reply to One Liner works on SUN but not on Linux??
Are you sure the configuration file is exactly the same on both platforms? The only obvious problem I see with it is that you don't check if the s/// succeeds, so you could be stomping all over your variables when there is nothing to substitute. (Well, that and the fact that you are using $a as a temporary variable, when it has a reserved meaning. It's not a good idea, but it should still work.)
perl -p -e 'if(s/^(\d+)://g) { my $x = $1; s/\d+/$x/g; }' foo.txt
This code works as you expect it to on my Red Hat machines, but then so does your original code.
You might try running cat -vet on your configuration files on each host, to make sure they don't contain anything you didn't expect. I would also try setting LANG=C before running it on linux, to see if your configuration file contains something odd that is getting messed up because Red Hat is setting the default LANG to utf-8.
| We're not surrounded, we're in a target-rich environment! |
|---|
|
|---|