Subject: Re: Suggestion: keep binary data out of /etc
To: Shyeah right. What am I gonna do with a gun rack? <>
From: Matthew Orgass <>
List: current-users
Date: 02/11/1999 02:42:29
On Wed, 10 Feb 1999, Shyeah right.  What am I gonna do with a gun rack? wrote:

> - Have 'binary' mode translate into 'treat all non-printing charaacters
>   as newlines.'

  I'll vote for this (as an option, current behavior default).  Just
saying that a file contains at least one match is usually not much use 
(if I only wanted the name of files that matched, I would grep -l).  It
would also probably be a good idea to at least have the option to produce
the same output as every other GNU grep of the same vintage.  Aliasing to
make it do what you want by default is not hard, but IMO it should follow
historical practice (and it's defined purpose) by default.

> - Patch strings(!) to output the file name before each line (optionally)
>   for multiple files (as grep does currently) and run that output through
>   grep.

  But then if the filename matches, it will match all strings in the
file...  It's better then the current situation, but not as good of a
final solution.

> ...and, realistically, it's the one that seems to make the most sense,
> considering that our strings is not so drain-bamaged as to be restricted
> to ccs-generated files.

  Yes, having the option to use strings with grep on multiple files makes
the most sense, but it should be done in grep not strings.

> Of course, that could be done via:
> for file in $filelist; do {
>     strings $file | sed "s/^/$file: /g";
> } done;
> and pipe THAT through grep, so never mind the comment about it making
> the most sense.

  Or you could just do Perl Magic and do the whole thing (grep and all) in
about ten characters (but only a true Perl Programmer would be able to
figure out why it worked :) ).

Matthew Orgass