NAME
grep, g – search a file for a pattern |
SYNOPSIS
grep [ –bchiLlnsv ] [ –e ] pattern | –f patternfile [ file ... ] g [ flags ] pattern [ file ... ] |
DESCRIPTION
Grep searches the input files (standard input default) for lines
that match the pattern, a regular expression as defined in regexp(6)
with the addition of a newline character as an alternative (substitute
for |) with lowest precedence. Normally, each line matching the
pattern is `selected', and each selected line is copied to
the standard output.
The options are: Output lines are tagged by file name when there is more than one input file. (To force this tagging, include /dev/null as a file name argument.) Care should be taken when using the shell metacharacters $*[^|()=\ and newline in pattern; it is safest to enclose the entire expression in single quotes '...'. An expression starting with '*' will treat the rest of the expression as literal characters. G invokes grep with –n (plus additional flags, if provided) and forces tagging of output lines by file name. If no files are listed, it recursively searches the current directory for all files matching *.b *.c *.C *.h *.l *.m *.s *.y *.asm *.awk *.cc *.cgi *.cpp *.cs *.go *.goc *.hs *.java *.lua *.lx *.mk *.ml *.mli *.ms *.myr *.pl *.py *.rc *.sh *.tex *.xy
The recursive search can be suppressed by passing g the –n flag. |
SOURCE
/sys/src/cmd/grep /rc/bin/g |
SEE ALSO
ed(1), awk(1), sed(1), sam(1), regexp(6) |
DIAGNOSTICS
Exit status is null if any lines are selected, or non–null when
no lines are selected or an error occurs. |