Организация UNIX-систем и ОС Solaris


В ответ система выдаст следующую

man grep

В ответ система выдаст следующую информацию:

Name grep - search a file for a pattern

Synopsis /usr/bin/grep [-bchilnsvw] limited-regular-expression [filename...] /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] -e pattern_list... [-f pattern_file]... [file...] /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] [-e pattern_list...] -f pattern_file... [file...] /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] pattern [file...]


The grep utility searches text files for a pattern and prints all lines that contain that pattern. It uses a compact non-deterministic algorithm.

Be careful using the characters $, *, [, ^, |, (, ), and \ in the pattern_list because they are also meaningful to the shell. It is safest to enclose the entire pattern_list in single quotes `... `.

If no files are specified, grep assumes standard input. Normally, each line found is copied to standard output. The file name is printed before each line found if there is more than one input file.


The /usr/bin/grep utility uses limited regular expressions like those described on the regexp(5) manual page to match the patterns.


The options -E and -F affect the way /usr/xpg4/bin/grep interprets pattern_list. If -E is specified, /usr/xpg4/bin/grep interprets pattern_list as a full

regular expression (see -E for description). If -F is specified, grep interprets pattern_list as a fixed string. If neither are specified, grep interprets pattern_list

as a basic regular expression as described on regex(5) manual page.


The following options are supported for both /usr/bin/grep and /usr/xpg4/bin/grep:


Precede each line by the block number on which it was found. This can be useful in locating block numbers by context (first block is 0).


Print only a count of the lines that contain the pattern.


Prevents the name of the file containing the matching line from being appended to that line. Used when searching multiple files.

Содержание  Назад  Вперед