perlquestion
dvergin
I don't use one-liners routinely, but when the boss-man asked for a quicky to make the same change in 150 files in a directory, I dashed off:
<code>
perl -pi -e 's/this/that/' *
</code>
...and looked like a hero.
<p />
Then he said, "Make it work for a whole directory branch." I was stumped. I can (and did) write a short script to do this. But I have a lingering suspicion that there is some command-line magic that can, in effect do:
<code>
perl -r -pi -e 's/this/that/' *
</code>
Where the '-r' switch works as in other Linux commands to cause the requested operation to be performed on all directories including and under the current one.
<p />
Sadly, there is no '-r' switch for the Perl executable.
<p />
Does anyone have a quick command-line hack (rather than a script) to accomplish the requested task.
<p align="center">
------------------------------------------------------------
<br>
<font size="-1">"<i>Perl is a mess
and that's good because the
<br />problem space is also a mess.</i>" - Larry Wall</font>
</p>