Yary has asked for the wisdom of the Perl Monks concerning the following question:
And then Window's cmd shell passes along *.txt and *.doc to perl, and perl cannot find a file called *.txt or *.doc, only files like "flavors.txt" and "plants.doc".perl -pi.bak "s/vanilla/strawberry/gi" *.txt *.doc
In general I can't install modules on these systems, and don't have friendlier shells to choose from. So I will either copy & paste the full files names, or if there are too many, I'll add a BEGIN block to the one-liner, eg:
perl -pi.bak "BEGIN{@ARGV=map glob,@ARGV}s/vanilla/strawberry/gi" *.txt *.doc
Anyone want to golf? Less to type for the one liners, the better.
/me wishes there was a command-line switch to have the perl interpreter do the globbing for me.
|
|---|