Not the problem he's trying to solve - he doesn't want line numbers.
By default, binary files won't print out the line (since it's not human
readable), but text files will. If you want to force line output, Bryan was
still on the right path, RTFM:
-a, --text
Process a binary file as if it were text; this
is equivalent to the
--binary-files=text option.
--binary-files=TYPE
If the first few bytes of a file indicate that the file
contains binary data, assume
that the file is of type TYPE. By default, TYPE is binary,
and grep normally outputs
either a one-line message saying that a binary file matches,
or no message if there is
no match. If TYPE is without-match, grep assumes that a
binary file does not match;
this is equivalent to the -I option. If TYPE is text, grep
processes a binary file as
if it were text; this is equivalent to the -a
option. Warning: grep
--binary-files=text might output binary garbage, which can
have nasty side effects if
the output is a terminal and if the terminal driver interprets
some of it as commands.
On Fri, Sep 3, 2010 at 12:34 AM, Bryan Smith <[email protected]> wrote:
> Sorry, I said RTFM with a smile :o)
>
>
> On Fri, Sep 3, 2010 at 1:33 AM, Bryan Smith <[email protected]>wrote:
>
>> RTFM
>>
>> -n, --line-number
>> Prefix each line of output with the 1-based line number
>> within
>> its input file. (-n is specified by POSIX.)
>>
>>
>> On Thu, Sep 2, 2010 at 11:49 PM, Mike <[email protected]> wrote:
>>
>>> I am using grep to search for strings in a block of code. The man page
>>> for grep says that "By default, grep prints the matching lines". Yet
>>> the system only tells me when there is a match; it doesn't print the
>>> relevant lines. I searched this group and the web for "grep output"
>>> and found nothing useful. How can I get grep to print out lines
>>> containing a match?
>>>
>>> $ grep graphic gnuchess-5.0*
>>> Binary file gnuchess-5.05.tar matches
>>> Binary file gnuchess-5.06.tar matches
>>> Binary file gnuchess-5.07.tar matches
>>>
>>> --
>>> You received this message because you are subscribed to the Linux Users
>>> Group.
>>> To post a message, send email to [email protected]
>>> To unsubscribe, send email to
>>> [email protected]
>>> For more options, visit our group at
>>> http://groups.google.com/group/linuxusersgroup
>>
>>
>>
>>
>> --
>> A healthy diet includes Linux, Linux, and more Linux.
>>
>
>
>
> --
> A healthy diet includes Linux, Linux, and more Linux.
>
> --
> You received this message because you are subscribed to the Linux Users
> Group.
> To post a message, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit our group at
> http://groups.google.com/group/linuxusersgroup
>
--
Daniel
--
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at
http://groups.google.com/group/linuxusersgroup