Jerry Rocteur wrote:

> Hi,
> 
> I'm trying to use perl for most shell stuff and this is some of the
> stuff I'm using for grep ..
> 
> perl -ne 'print "$ARGV: $_" if /jerry/i ' *
> perl -ne 'print  if /jer{1,}y/i ' *
> perl -ne 'print  unless /jer{1,}y/i ' *
> 
> I'm enjoying this as I can do a lot more than I can with the old egrep
> on our Solaris boxes..
> 
> What I'd like to do is to make a simple change NOT to check in binary
> files and directories..
> 

have you try:

[panda]# perl -ne 'print unless -B $ARGV' *

which is not very efficient because of the stat on every line. a more 
efficient approach is to isolate the binary files first and then print the 
rest like:

[panda]# perl -pe1 `perl -le '-B or print for @ARGV' *`
[panda]# perl -e '-B or open(F,$_) && print<F> for @ARGV' *

which is bit longer but much faster.

david
-- 
s,.*,<<,e,y,\n,,d,y,.s,10,,s
.ss.s.s...s.s....ss.....s.ss
s.sssss.sssss...s...s..s....
...s.ss..s.sss..ss.s....ss.s
s.sssss.s.ssss..ss.s....ss.s
..s..sss.sssss.ss.sss..ssss.
..sss....s.s....ss.s....ss.s

,....{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t,
.y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:[EMAIL PROTECTED] ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to