How hard would it be to make a directory equivalent of the -n
command-line flag?
The reason I ask, is because I keep doing this:
perl5 -le '$/="";opendir(D,".");for$f(sort grep /^[^.]/,readdir D){open(F,$f);while(<F>){/war and peace/i && print("$f: $_")&& exit}}'
To get at files in a directory. Yes, I could do:
perl -lne ... *
But, I'm doing this in a news spool, and the shell returns: "Agument
list too long".... So, I do it all by hand. But what would be nice is
something like:
perl -directory . -lne '/war and peace/i && print && exit'
I know this is just a request for a workaround to an OS limitation,
but isn't that was perl *is*.... ;-)
-AJS
--
Aaron Sherman <ajs@ajs.com> This " " B4 f w+ c kv s+(--)v r p
I-Kinetics, Inc. for rent Pager: (508)545-0584
1 NE Executive Park Fax: (617)270-4979
Burlington, MA 01803-5005 Desk: (617)252-3489
ajs@ajs.com or ajs@openmarket.com WWW: http://ajs.com/~ajs/
command-line flag?
The reason I ask, is because I keep doing this:
perl5 -le '$/="";opendir(D,".");for$f(sort grep /^[^.]/,readdir D){open(F,$f);while(<F>){/war and peace/i && print("$f: $_")&& exit}}'
To get at files in a directory. Yes, I could do:
perl -lne ... *
But, I'm doing this in a news spool, and the shell returns: "Agument
list too long".... So, I do it all by hand. But what would be nice is
something like:
perl -directory . -lne '/war and peace/i && print && exit'
I know this is just a request for a workaround to an OS limitation,
but isn't that was perl *is*.... ;-)
-AJS
--
Aaron Sherman <ajs@ajs.com> This " " B4 f w+ c kv s+(--)v r p
I-Kinetics, Inc. for rent Pager: (508)545-0584
1 NE Executive Park Fax: (617)270-4979
Burlington, MA 01803-5005 Desk: (617)252-3489
ajs@ajs.com or ajs@openmarket.com WWW: http://ajs.com/~ajs/