[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Grepping only text files



>From: Ronald J Kimball <rjk@linguist.dartmouth.edu>
>Date: Tue, Jun 29, 1999, 3:16 PM
>

> I see your point.  How about using Tom's tcgrep instead?  It skips binary
> files by default, and has a command line switch to include them in the
> search.
>
> http://language.perl.com/ppt/src/grep/tcgrep


Is there a 'strings'-equivalent function in perl?

Just because a file is binary doesn't mean
it has nothing to offer...

I am trying to write one, but I keep tripping
over myself - those damn knuckles dragging
get me every time...

Something like -

@strings = grep {m/data/} $files unless (-B $files);
@strings = grep {m/data/} `strings $files` if (-B $files);

I could use the 'Useless use of cat' approach...

???
-Sneex-  :]
FCCJ Data Security Group
______________________________________________________________________
Bill Jones  Data Security Specialist  http://www.fccj.org/cgi/mail?dss

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org