grep: Other Options
2.1.7 Other Options
-------------------
‘--’
Delimit the option list. Later arguments, if any, are treated as
operands even if they begin with ‘-’. For example, ‘grep PAT --
-file1 file2’ searches for the pattern PAT in the files named
‘-file1’ and ‘file2’.
‘--line-buffered’
Use line buffering for standard output, regardless of output
device. By default, standard output is line buffered for
interactive devices, and is fully buffered otherwise. With full
buffering, the output buffer is flushed when full; with line
buffering, the buffer is also flushed after every output line. The
buffer size is system dependent.
‘-U’
‘--binary’
On platforms that distinguish between text and binary I/O, use the
latter when reading and writing files other than the user’s
terminal, so that all input bytes are read and written as-is. This
overrides the default behavior where ‘grep’ follows the operating
system’s advice whether to use text or binary I/O. On MS-Windows
when ‘grep’ uses text I/O it reads a carriage return–newline pair
as a newline and a Control-Z as end-of-file, and it writes a
newline as a carriage return–newline pair.
When using text I/O ‘--byte-offset’ (‘-b’) counts and
‘--binary-files’ heuristics apply to input data after text-I/O
processing. Also, the ‘--binary-files’ heuristics need not agree
with the ‘--binary’ option; that is, they may treat the data as
text even if ‘--binary’ is given, or vice versa. ⇒File and
Directory Selection.
This option has no effect on GNU and other POSIX-compatible
platforms, which do not distinguish text from binary I/O.
‘-z’
‘--null-data’
Treat input and output data as sequences of lines, each terminated
by a zero byte (the ASCII NUL character) instead of a newline.
Like the ‘-Z’ or ‘--null’ option, this option can be used with
commands like ‘sort -z’ to process arbitrary file names.