линии печати, соответствующие шаблонам (print lines that match patterns)
Примеры (Examples)
The following example outputs the location and contents of any
line containing 'f' and ending in '.c', within all files in the
current directory whose names contain 'g' and end in '.h'. The
-n
option outputs line numbers, the --
argument treats expansions
of '*g*.h' starting with '-' as file names not options, and the
empty file /dev/null causes file names to be output even if only
one file name happens to be of the form '*g*.h'.
$ grep
-n -- 'f.*\.c$' *g*.h /dev/null
argmatch.h:1:/* definitions and prototypes for argmatch.c
The only line that matches is line 1 of argmatch.h. Note that
the regular expression syntax used in the pattern differs from
the globbing syntax that the shell uses to match file names.