Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Perl on windows, one-liners with wildcards/globby Yary (Pilgrim) |
on Oct 21, 2011 at 23:17 UTC ( [id://932992]=perlquestion: print w/replies, xml ) | Need Help?? |
Yary has asked for the wisdom of the Perl Monks concerning the following question:
Time to time I find myself on a windows host trying to run a one-liner such as:
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". 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.
Back to
Seekers of Perl Wisdom
|
|