-i
Large File Behavior
See largefile(5) for the description of the behavior of grep when encountering files greater than or equal to 2 Gbyte ( 2 **31 bytes).
Examples Example 1: Finding all uses of a word To find all uses of the word "Posix" (in any case) in the file text.mm, and write with line numbers: example% /usr/bin/grep -i -n posix text.mm
Example 2: Finding all empty lines To find all empty lines in the standard input: example% /usr/bin/grep ^$ or example% /usr/bin/grep -v .
Example 3: Finding lines containing strings Both of the following commands print all lines containing strings abc or def or both: example% /usr/xpg4/bin/grep -E `abc def' example% /usr/xpg4/bin/grep -F `abc def'
Example 4: Finding lines with matching strings Both of the following commands print all lines matching exactly abc or def: example% /usr/xpg4/bin/grep -E `^abc$ ^def$' example% /usr/xpg4/bin/grep -F -x `abc def'
Environment Variables
See environ(5) for descriptions of the following environment variables that affect the execution of grep: LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Exit Status The following exit values are returned: 0 One or more matches were found. 1 No matches were found. 2 Syntax errors or inaccessible files (even if matches were found).
See Also egrep(1) , fgrep(1) , sed(1) , sh(1) , attributes(5) , environ(5) , largefile(5) , regex(5) , regexp(5) , XPG4(5)
Notes /usr/bin/grep
Lines are limited only by the size of the available virtual memory. If there is a line with embedded nulls, grep will only match up to the first null; if it matches, it will print the entire line.
/usr/xpg4/bin/grep
The results are unspecified if input files contain lines longer than LINE_MAX bytes or contain binary data. LINE_MAX is defined in /usr/include/limits.h.
Пример 8.1. Результат работы команды man grep
Вывод man grep сильно сокращен, так как здесь нам требуется не детальный обзор grep, а общий вид какой-нибудь страницы руководства.
Первый блок информации, представленный в верхней строке, сообщает заголовок страницы руководства и номер раздела.
Обратите внимание на то, что в Solaris 9 поддерживается две версии grep - классическая (/usr/bin/grep) и расширенная (/usr/xpg4/bin/grep).
Ниже рассмотрены элементы страницы руководства, которые могут помочь вам не только разобраться в предмете, но и получить направление для нового поиска.