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



         

Руководство по Solaris - часть 2


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...]

Description

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.

/usr/bin/grep

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

/usr/xpg4/bin/grep

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.

Options

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

-b

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).

-c

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

-h

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




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