Monitoring, Management & Location Tracking

grep: Binary file [some_file] matches

If you try to grep a file and you get something like the following:

Binary file [some_file] matches

...this is what's happening...

[from the grep man page]

Normally, if the first few bytes of a file indicate that the file contains binary data, grep outputs only a message saying that the file matches the pattern.

To force the file to be treated as text, use the -a (or --text) option.

# grep -a pattern some_file

This option causes grep to act as if the file is a text file, even if it would otherwise be treated as binary.

NOTE: the result might be binary garbage printed to the terminal, which can have nasty side-effects if the terminal driver interprets some of it as commands.

Version History
Revision #:
1 of 1
Last update:
‎06-30-2014 11:47 PM
Updated by:
Labels (2)
Search Airheads
Showing results for 
Search instead for 
Did you mean: 
Is this a frequent problem?

Request an official Aruba knowledge base article to be written by our experts.