FWPers,

Pretending your machine did not have e?grep, how concisely could you
duplicate the GNUish "-q" (silent) functionality: stop scanning on
first match and exit(0). If no match, exit(1).

Here's something simple to start with:

perl -n0777
exit !(/pattern/)

Necessary Improvements:

- concisely get the pattern from the command-line (e.g., pattern as
  $ARGV[0] and the file as $ARGV[1]) such that the syntax is more like
  grep (e.g., grep 'pattern' filename => perl -args 'pattern' filename)?

Extra Credit:

- is there a short way to do it without slurping the whole file?

Any takers?

Scott
-- 
Scott Wiersdorf
[EMAIL PROTECTED]

Reply via email to