In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Linux grep basic entry knowledge points of what the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that you will have some gains after reading this Linux grep basic introduction knowledge points, let's take a look at it.
The grep directive is used to find files that contain the specified template style. If the contents of a file are found to match the specified template style, the default grep directive will display the column containing the template style. If no file name is specified, or if the file name given is -, the grep instruction reads the data from the standard input device.
Basic introduction
Grep command consists of options, patterns and files, it searches for lines of text that meet the pattern in one or more files, all strings after the pattern are regarded as file names, file names can be multiple, support wildcard writing, and the search results are printed to the screen without affecting the contents of the original file. The options of the grep command are used to supplement the search process, and the options of the grep command and their meaning are shown in the following table.
Option feature-I ignores case-w matches individual complete words-I lists only files that match, but does not list lines-r recursive matching-n lists lines and displays line numbers-v reverse matching-c shows the number of matching lines, no content-f file extracts templates from file file as matching patterns-E uses extended regular expressions-F for fast matching Do not use regular expression-A n to print match lines and then n lines-B n to print match lines and their first n lines-C n print match lines and before and after n lines-o show only the matching content-Q does not output content, the exit state represents the regular expression of the search results
Using regular expressions with metacharacters in the grep command makes it more flexible to match information, and you need to enclose the regular expressions in single quotes to avoid unpredictable errors.
The mode function'^ h' finds lines starting with the h sign'^ $'matches blank lines' ^ /. / 'matches lines beginning with a slash pair with three characters in the middle' ^ /. * / 'matches lines that begin with a slash pair There can be any content [: alpha:] matching character [: digit:] matching number [: alnum:] matching character or number [: word:] matching word character instance statistics / etc/init.d/functions file the number of times each word appears and sort grep-Eo'[: alnum:] _] +'/ etc/init.d/functions | sort | uniq-c | sort-nr to find duplicates in two files Line $cat test1aabbccdddeee$ cat test2aabbcccddeee$ grep-wf test1 test2aabbeee, this is the end of the article on "what are the basic knowledge points of Linux grep?" Thank you for reading! I believe you all have a certain understanding of "what are the basic basic knowledge points of Linux grep". If you want to learn more knowledge, you are welcome to follow the industry information channel.
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.