Similarly, it must be either at the end of the line or followed by a non-word constituent character. The test is that the matching substring must either be at the beginning of the line, or preceded by a non- word constituent character. w, -word-regexp Select only those lines containing matches that form whole words. v, -invert-match Invert the sense of matching, to select non-matching lines. i, -ignore-case Ignore case distinctions in both the PATTERN and the input files. The empty file contains zero patterns, and therefore matches nothing. If this option is used multiple times or is combined with the -e (-regexp) option, search for all patterns given. f FILE, -file=FILE Obtain patterns from FILE, one per line. This option can be used to protect a pattern beginning with “-”. If this option is used multiple times or is combined with the -f (-file) option, search for all patterns given. Matching Control -e PATTERN, -regexp=PATTERN Use PATTERN as the pattern. This is highly experimental and grep -P may warn of unimplemented features.
P, -perl-regexp Interpret the pattern as a Perl-compatible regular expression (PCRE).
G, -basic-regexp Interpret PATTERN as a basic regular expression (BRE, see below). F, -fixed-strings Interpret PATTERN as a list of fixed strings (instead of regular expressions), separated by newlines, any of which is to be matched. Matcher Selection -E, -extended-regexp Interpret PATTERN as an extended regular expression (ERE, see below). V, -version Output the version number of grep and exit. Option -help Output a usage message and exit. Grep $ grep a test1 Cat Man $ grep an test1 ManĢ. จากตัวอย่าง file test1 $ cat test1 Ant Bee Cat Dog Fly