In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what grep filtering commands are commonly used under Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Grep command is a powerful text search tool in Linux system. It can use regular expressions to search text and print matching lines. The full name of grep is Global Regular Expression Print, which represents the global regular expression version, and its permission is for all users.
Use grep to filter multiple conditions cat log.txt | grep condition; cat log.txt | grep condition 1 | grep condition 2; cat log.txt | grep condition 1 | grep condition 2 | grep condition 3; grep condition 1 log.txt | grep condition 2 | grep condition 3
Don't talk nonsense, for example, you need to exclude mmm nnn from abc.txt
Grep-v 'mmm\ | nnn' abc.txt
However, this is still a lot. We need to find the required ip address from these messages. We may have thought of using grep-v to block inet6. The result is as follows:
1. | bash-3.2# ifconfig | grep inet | grep-v inet62, | inet 127.0.0.1 netmask 0xff0000003, | inet 10.60.104.38 netmask 0xfffffe00 broadcast 10.60.105.255 take a look at the common linux grep filtering commands
The filtered content can be a phrase, etc., and needs to be wrapped in quotation marks
1. Get the keyword key: cat fileName | grep "key" 2. Get a keyword key1, key2, key3: cat fileName in the file | grep-E "key1 | key2 | key3" 3. Get multiple keywords in the file and satisfy: cat fileName | grep key1 | grep key2 | grep key34. Ignore a keyword in the file and escape "|": cat fileName | grep-v "key1\ | key2\ | key3". These are all the contents of the article "what are the common grep filtering commands under Linux?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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.