Sudo grep-irn \ 'compile \ '. // "." Keyword \ 'compile \ 'in the current directory \'
Sudo grep-rn \ 'compile \'.
Find.-tyep f [-print] | xargs grep abc // find command
Sudo grep-I \ 'compile \ 'ltls. c // find the keyword \ 'compile \ 'in the ltls. c file \'
[Additional] grep-l \ 'string \ '/DIR /*
Usage: grep [Option]... mode [file]...
Search for styles or standard inputs in each file.
By default, PATTERN is a basic regular expression (BRE ).
Example: grep-I \ 'Hello world \ 'menu. h main. c
Selection and interpretation of Regular Expressions:
-E, -- extended-regexp PATTERN is an extended regular expression (ERE)
-F, -- fixed-strings PATTERN is a set of new line separator repair strings
-G, -- basic-regexp PATTERN is a basic regular expression (BRE)
-P, -- perl-regexp PATTERN is a Perl regular expression.
-E, -- regexp = PATTERN use PATTERN to match
-F, -- file = FILE get PATTERN from FILE
-I, -- ignore-case ignore case sensitivity
-W, -- word-regexp force PATTERN to match only the entire word
-X, -- line-regexp force PATTERN to match only the whole line
-Z, -- null-data end with 0 bytes rather than the data row with the new line operator
Miscellaneous:
-S, -- no-messages Do Not Display error messages
-V, -- invert-match: Select unmatched rows
-V, -- version: print the version information and exit
-- Help: displays the help and exits.
-- If possible, mmap uses a memory image as the input.
Output Control:
-M, -- max-count = NUM: stops when NUM matches
-B, -- byte-offset: prints the byte displacement at the same time as the output row.
-N, -- line-number: print the number of rows at the same time as the output row.
-- Line-buffered flush output on every line
-H, -- with-filename print the filename for each match
-H, -- no-filename suppress the prefixing filename on output
-- Label = LABEL print LABEL as filename for standard input
-O, -- only-matching show only the part of a line matching PATTERN
-Q, -- quiet, -- silent suppress all normal output
-- Binary-files = TYPE assume that binary files are TYPE;
TYPE is 'binary \ ', 'text \', or 'without-match \'
-A, -- text is equivalent to -- binary-files = text
-I is equivalent to -- binary-files = without-match
-D, -- directories = ACTION how to handle directories;
ACTION is 'read \ ', 'Curse \', or 'skip \'
-D, -- devices = ACTION how to handle devices, Guest OS and sockets;
ACTION is 'read \ 'or 'skip \'
-R,-r, -- recursive is equivalent to -- directories = recurse
-- Include = FILE_PATTERN: Only search for files that conform to the FILE_PATTERN type.
-- Exclude = FILE_PATTERN: skips the file or directory named FILE_PATTERN.
-- Exclude-from = FILE skip files matching any file pattern from FILE
-- Exclude-dir = PATTERN directories that match PATTERN will be skipped.
-L, -- files-without-match print only names of FILEs containing no match
-L, -- files-with-matches print only names of FILEs containing matches
-C, -- count print only a count of matching lines per FILE
-T, -- initial-tab make tabs line up (if needed)
-Z, -- null FILE name and then print 0 bytes
Context control:
-B, -- before-context = NUM print the NUM row above
-A, -- after-context = NUM print NUM rows below
-C, -- context = NUM print the NUM row output context
-Num is the same as -- Context = num.
-- Color [= when],
-- Color [= when] uses tags to highlight matched strings;
When can be set to "always", "never", or "Auto"
-U, -- binary does not remove the CR characters at EOL (msdos)
-U, -- Unix-byte-offsets if Cr is not there (msdos), report the Offset Value
'Egrep 'and 'grep-e' have the same meaning. 'Fgrep' and 'grep-F' have the same meaning.
The method of directly calling 'egrep 'and 'fgrep' has been deprecated.
If no file or file is-, the standard input is read. If there are less than two files,
Assume-H. If any row is selected, the exit status is 0;
If any error occurs and-q is not given, the exit status is 2.