In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what is grep regular expression", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is grep regular expression" this article.
A regular expression is just a description of a string, and string processing can only be done in combination with tools that support regular expressions.
Grep matching pattern
Grep accepts options and parameters as follows (where regex represents a regular expression)
W. Grep [option] Regex [file]
Options is mainly the following table:
Option meaning function description-i ignore case ignores case-v invert match mismatches-l file-with-match output matched file names-L file-without-match output mismatched file names-number of c count output matches (lines)-n number output matches lines while adding the file name and the number of lines in the file name-h no-filename suppresses the output of the file name
Suppose there are three files-del1, del2, del3-the contents are as follows
Examples
Getting started with grep regular expressions in Linux getting started with grep regular expressions in Linux
Special character
Symbolic meaning example ^ start mark "^ abc" satisfy example abc, abcd^ not (in []) "[^ abc]" satisfy example: ddd, mpd$ end tag "abc$" satisfy example abc, mmabc. Any character "A.C" satisfies the examples abc, fapcc\ "\ matches the word ending" abc\ > "abc, pmrabc | or" AAA | BBB "satisfies the examples AAA, BBBpp
Range
Examples of symbolic meaning? Match the previous character 0 or 1 time "abc?" Satisfied examples ab and mabcd* match previous character ≥ 0 times "abc*" examples abbb and abcdk+ match previous character ≥ 1 times "abc+" examples abcd, abcccdd {} {m}, {m,}, {m,}, { N} is the example abcccc or abcccccc that matches the previous character m times, m to n times, ≥ m times, ≤ n times "abc\ {3jue 5\}", respectively, if it is not in the range. Choose one. If it is a range, select one of the examples satisfied by "m [ABC] p" in the range, acpd;m [1-9] p satisfied example m8pp (), put all the elements of the candidate in (), and use | separate the examples a1bc and mba3bcd satisfied by "a (1 | 2 | 3) bc".
Note: {} needs to be transferred in the Zheng expression, but {} () does not.
Note the example of understanding the {} scope:
Standard character class
Character class defines [: alnum:] letters and numbers, equivalent to [A-Za-z0-9] [: word:] [: alnum:] and underscore _ [: alpa:] letters, equivalent to [A-Za-z] [: digit:] numbers, equivalent to [0-9] equivalent to [: xdigit:] hexadecimal characters, equivalent to [0-9A-Fa-f equivalent] [: blank:] spaces and tabs [: graph:] visible characters By expanding 33x126 [: lower:] lowercase letters [: upper:] uppercase letters [: print:] printable characters [: space:] blank characters, equivalent to [\ t\ r\ n\ v\ f] [: punct:] punctuation [: cntrl:] ASCII control code, including characters 0x31 and 127. all the contents of the article "what is grep regular expressions"? 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.