In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use the grep instruction in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Grep
Function description: find qualified strings in the file
Syntax: grep [roomabcEFGhHilLnqrsvVwxy] [A shows the number of columns] [B shows the number of columns] [C shows the number of columns] [d takes actions]
[e template style] [f template file] [template help] [template style] [file or directory.]
Note: the grep directive is used to find files that contain the specified template style, if the contents of a file are found to match
For the specified template style, the default grep instruction displays the column that contains the template style. If no text is specified
Item name, or the given file name is "", the grep instruction reads the data from the standard input device
Parameters:
-E,-- extended-regexp PATTERN is treated as an extended regular expression
-F,-- fixed-stringsPATTERN is a collection of strings opened with newline characters
-G,-- basic-regexp PATTERN is regarded as a basic regular expression
-P,-- perl-regexp PATTERN is regarded as a regular expression of Perl
The PATTERN is treated as a regular expression by PATTERN.
-fmam Murtel filekeeper file to get PATTERN from FILE
-imam, Mutual, Mutual, case, ignore upper and lower case instructions.
The PATTERN is forced to match only complete words.
-xmam Murray lineMutual regexp forces PATTERN to match only complete rows
The data line ends with zero bytes instead of a newline character
Miscellaneous:
No error message is displayed in the smam murmurno message.
-vmam murmur match chooses rows that do not match
-VMagneWhile version prints the version information and exits
-- help displays this help and exits
-- mmap, if possible, use a memory image as input
Output control:
-mmam _ mam _ mam _ Maxi _ count= number of times to stop working after matching the specified number.
-bmam Murtel bytemuroffset outputs matching lines and displays byte offsets
-nmam Murray lineMutual number outputs the matching line and displays the line number
-- line-buffered flush output on each line
-H,-- with-filename outputs each matching file name
-h,-- no-filename outputs file names that do not show prefixes
-- the label= flag specifies the file name as standard output
-o,-- only-matching displays only lines that match the pattern
-Q,-- quiet,-- silent does not show all normal output
The binary-files= type assumes that the parameter is the specified binary file
It can be "binary", "text" or "without-match"
-a,-- text is equivalent to-- binary-files=text
-I equals-- binary-files=without-match
The-d,-- directories= behavior specifies how directories are handled
It can be "read", "recurse" or "skip"
-D,-- the devices= behavior specifies the
It could be read or skip.
-R,-r,-- recursive is equivalent to-- directories=recurse
-- include= pattern matching specified files will be checked
-- exclude= pattern matching specified files will be skipped
-- exclude-from= files that match the specified pattern will be skipped
-L,-- files-without-match prints only mismatched names
-l,-- files-with-matches prints only matching names
-c,-- count prints only the number of matching lines for each
-Z,-- null outputs "0" bytes after the name
Context control:
The content of the previous line is printed by Bjinghui Mutual, Mutual, and contextworthy NUM
The content of the line after being printed by Amam after being printed
The output of the printed line of Cmam Meltel contextual NUM
-NUM and-- context=NUM are the same
-- color [= WHEN]
-- color [= WHEN] uses flags to distinguish matching strings.
WHEN can be "always", "never" or "auto".
The carriage return character is not removed at the trailing mark of the MSDOS style file.
If there is no carriage return, then the offset is reported.
"egrep" means "grep-E" and "fgrep" means "grep-F".
If it is not given, or -, then read from standard input. If
Given that the quantity is less than 2, the-h option is assumed. Exit status 0 indicates a match
1 indicates a mismatch and 2 indicates an error.
This is the end of this article on "how to use grep instructions in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.