Home >Operation and Maintenance >Linux Operation and Maintenance >What does the Linux grep command do?
The Linux grep command is used to find strings that meet the conditions in the file.
The grep command is used to find files whose content contains the specified template style. If the content of a file is found to match the specified template style, the default grep command will display the column containing the template style. If no file name is specified, or if - is given, the grep command reads data from the standard input device.
Syntax:
grep
Parameters:
-a or --text: Do not ignore binary data.
-A
-b or --byte-offset: Mark the number of the first character of the line before displaying the line that matches the style.
-B
-c or --count : Count the number of columns that match the style.
-C
-d
-e or --regexp= : Specify a string as the style for searching file content.
-E or --extended-regexp: Use extended regular expression style.
-f
-F or --fixed-regexp : Treat styles as a list of fixed strings.
-G or --basic-regexp : Treat the style as a normal notation.
-h or --no-filename: Do not indicate the file name to which the line belongs before displaying the line that matches the style.
-H or --with-filename: Before displaying the line that matches the style, indicates the file name to which the line belongs.
-i or --ignore-case: Ignore differences in character case.
-l or --file-with-matches: List file names whose file contents match the specified pattern.
-L or --files-without-match: List file names whose content does not match the specified style.
-n or --line-number: Before displaying the line that matches the style, indicate the column number of the line.
-o or --only-matching: Only display the matching PATTERN part.
-q or --quiet or --silent: Do not display any information.
-r or --recursive: The effect of this parameter is the same as specifying the "-d recurse" parameter.
-s or --no-messages: Do not display error messages.
-v or --invert-match : Display all lines that do not contain matching text.
-V or --version : Display version information.
-w or --word-regexp: Only display columns that match whole words.
-x --line-regexp: Only display columns that match all columns.
-y: The effect of this parameter is the same as specifying the "-i" parameter.
The above is the detailed content of What does the Linux grep command do?. For more information, please follow other related articles on the PHP Chinese website!