In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, I would like to share with you how to find the relevant knowledge points that are not included in grep in linux. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
In linux, you can use the "- v" parameter of the grep command to find the string that meets the criteria in the file. When the parameter is set to "- v", it indicates a reverse selection and displays all lines that do not contain matching text. The syntax is "string file name that grep-v does not contain".
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to find grep in linux does not contain
The Linux grep command is used to find strings that match the criteria in the file.
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.
[root@www ~] # grep [- acinv] [--color=auto] 'search string' filename
Options and parameters:
-a: search binary files for data in the form of text files
-c: calculates the number of times a 'search string' is found
-I: ignore the case difference, so the case is considered the same
-n: output the line number by the way
-v: reverse selection, that is, the line that shows no 'search string' content! Show all lines that do not contain matching text
-- color=auto: you can add the color display to the keywords you find.
For example, I need to extract rows without ok and count the corresponding number of rows
Grep-cv "OK" result
Or
Grep-v "OK" result | wc-l
Displays rows and the number of rows without ok
Grep-nv "OK" result is all the content of this article "how to find grep in linux does not include". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.