print lines matching a pattern
|
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files. (-i is specified by POSIX.)
|
-H, --with-filename
Print the file name for each match. This is the default when there is more than one file to
search.
|
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally
have been printed. The scanning will stop on the first match. (-l is specified by POSIX.)
|
-n, --line-number
Prefix each line of output with the 1-based line number within its input file. (-n is specified
by POSIX.)
|
-R, -r, --recursive
Read all files under each directory, recursively; this is equivalent to the -d recurse option.
|
grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus
(-) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints
the matching lines.
|
Before a command is executed, its input and output may be redirected using a special notation interpreted
by the shell. Redirection may also be used to open and close files for the current shell execution
environment. The following redirection operators may precede or appear anywhere within a simple command
or may follow a command. Redirections are processed in the order they appear, from left to right.
Redirecting Output
Redirection of output causes the file whose name results from the expansion of word to be opened for
writing on file descriptor n, or the standard output (file descriptor 1) if n is not specified. If the
file does not exist it is created; if it does exist it is truncated to zero size.
The general format for redirecting output is:
[n]>word
If the redirection operator is >, and the noclobber option to the set builtin has been enabled, the
redirection will fail if the file whose name results from the expansion of word exists and is a regular
file. If the redirection operator is >|, or the redirection operator is > and the noclobber option to
the set builtin command is not enabled, the redirection is attempted even if the file named by word
exists.
|