Log in to ask questions, share your expertise, or stay connected to content. Don’t have a login? Join now.
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.Example:# grep -a pattern some_fileThis 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.
© Copyright 2024 Hewlett Packard Enterprise Development LPAll Rights Reserved.