M
Markus Dehmann
What's the easiest way to modify a string on the command line (using
perl)?
I want to change
a/b/c/d
to
a_b_c_d
The following line does it, but it's long and cumbersome:
perl -e '$ARGV[0] =~ s#/#_#g; print $ARGV[0]' "a/b/c/d"
Isn't there a special perl switch that puts $ARGV[0] into $_ or so?
Then, I could just say:
perl -e 's#/#_#g; print' "a/b/c/d"
And it would be better without the "print" ...
Thanks!
Markus
perl)?
I want to change
a/b/c/d
to
a_b_c_d
The following line does it, but it's long and cumbersome:
perl -e '$ARGV[0] =~ s#/#_#g; print $ARGV[0]' "a/b/c/d"
Isn't there a special perl switch that puts $ARGV[0] into $_ or so?
Then, I could just say:
perl -e 's#/#_#g; print' "a/b/c/d"
And it would be better without the "print" ...
Thanks!
Markus