grep: Matching Control
1
1 2.1.2 Matching Control
1 ----------------------
1
1 ‘-e PATTERN’
1 ‘--regexp=PATTERN’
1 Use PATTERN as the pattern. If this option is used multiple times
1 or is combined with the ‘-f’ (‘--file’) option, search for all
1 patterns given. (‘-e’ is specified by POSIX.)
1
1 ‘-f FILE’
1 ‘--file=FILE’
1 Obtain patterns from FILE, one per line. If this option is used
1 multiple times or is combined with the ‘-e’ (‘--regexp’) option,
1 search for all patterns given. The empty file contains zero
1 patterns, and therefore matches nothing. (‘-f’ is specified by
1 POSIX.)
1
1 ‘-i’
1 ‘-y’
1 ‘--ignore-case’
1 Ignore case distinctions, so that characters that differ only in
1 case match each other. Although this is straightforward when
1 letters differ in case only via lowercase-uppercase pairs, the
1 behavior is unspecified in other situations. For example,
1 uppercase “S” has an unusual lowercase counterpart “ſ” (Unicode
1 character U+017F, LATIN SMALL LETTER LONG S) in many locales, and
1 it is unspecified whether this unusual character matches “S” or “s”
1 even though uppercasing it yields “S”. Another example: the
1 lowercase German letter “ß” (U+00DF, LATIN SMALL LETTER SHARP S) is
1 normally capitalized as the two-character string “SS” but it does
1 not match “SS”, and it might not match the uppercase letter “ẞ”
1 (U+1E9E, LATIN CAPITAL LETTER SHARP S) even though lowercasing the
1 latter yields the former.
1
1 ‘-y’ is an obsolete synonym that is provided for compatibility.
1 (‘-i’ is specified by POSIX.)
1
1 ‘-v’
1 ‘--invert-match’
1 Invert the sense of matching, to select non-matching lines. (‘-v’
1 is specified by POSIX.)
1
1 ‘-w’
1 ‘--word-regexp’
1 Select only those lines containing matches that form whole words.
1 The test is that the matching substring must either be at the
1 beginning of the line, or preceded by a non-word constituent
1 character. Similarly, it must be either at the end of the line or
1 followed by a non-word constituent character. Word-constituent
1 characters are letters, digits, and the underscore. This option
1 has no effect if ‘-x’ is also specified.
1
1 ‘-x’
1 ‘--line-regexp’
1 Select only those matches that exactly match the whole line. For a
1 regular expression pattern, this is like parenthesizing the pattern
1 and then surrounding it with ‘^’ and ‘$’. (‘-x’ is specified by
1 POSIX.)
1