2016-2-5 Linux Basic Learning 11

Source: Internet
Author: User
Tags uppercase letter

grep, Egrep, Fgrep

grep: Searches text according to pattern and displays lines of text that conform to the pattern
Pattern: Text Word wildcards regular the expression's meta-word combination and fly match condition

grep [Options] PATTERN [FILE ...]
-I is case insensitive
--color to match the criteria of the search character color
-V shows rows that are not matched by a pattern
-O displays only strings that are matched to the pattern, one row
650) this.width=650; "style=" width:550px;height:348px; "src=" http://s1.51cto.com/wyfs02/M00/7A/C6/ Wkiom1a0slmjahqjaagw4y0zvny522.png "title=" Grep1.png "height=" 348 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiom1a0slmjahqjaagw4y0zvny522.png "/>

*: Characters of any length
?: any single character
[]: matches any single character within the specified range
[^]: matches any single character outside the specified range


:
metacharacters :
    : matches any single character

matches (greedy mode, partial match)
match characters :
    *  : Match any of its preceding characters
    .* : Any character of any length
     [] : matches any single character within the specified range
    [^]: matches any single character outside the specified range
        [[:space:]]: blank character
        [[:p UNCT:]]: punctuation
         [[:lower:]]: Small Letter
        [[:upper:]]: Uppercase letter
         [[:alpha:]]: Uppercase and lowercase
        [[:d igit:]]: number
        [[:alnum:]]: Numeric and uppercase letters
   

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7A/C6/wKioL1a0s0DyHJi8AABYj_8ne5M076.png "style=" float: none; "title=" Grep2.png "alt=" Wkiol1a0s0dyhji8aabyj_8ne5m076.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/C6/wKiom1a0su2STtHSAAGMsltIUPI930.png "style=" width : 550px;height:556px; "title=" Grep2-1.png "height=" 556 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiom1a0su2stthsaagmsltiupi930.png "/>


\? : matches the preceding character 0/1 times

\{m,n\}: Matches its preceding characters, at least m times, up to N times
\{1,\} at least once, up to No limit
\{0,3\} up to three times
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7A/C6/wKioL1a0s3uz6bPpAACWflT-hSE579.png "title=" Grep2-2.png "alt=" Wkiol1a0s3uz6bppaacwflt-hse579.png "/>

Location anchoring :
^ Character: Anchor the beginning of the line, any content after this character must appear at the beginning of the line
Character $: Anchor Line end, any content after this character must appear at the end of the row
^$: Blank Line

\< or \b: Anchor word, any character following it must appear as the first word
\> or \b: anchors the ending, any character in front of which must appear as the tail of the word
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7A/C6/wKiom1a0s0yj1hC7AACmM5kcBNA039.png "title=" Grep3.png "alt=" Wkiom1a0s0yj1hc7aacmm5kcbna039.png "/>

Grouping \ (\):
\ (ab\) *:ab can occur 0 times/1 times

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/C6/wKioL1a0s8zj_OiOAAC0qCwiJLI097.png "title=" Grep5.png "alt=" Wkiol1a0s8zj_oioaac0qcwijli097.png "/>



Reverse Reference
\1: Refers to the first opening parenthesis and all the contents of the corresponding closing parenthesis
\2: Refers to the second opening parenthesis and all the contents of the corresponding closing parenthesis
\3: Refers to the third opening parenthesis and all the contents of the corresponding closing parenthesis

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7A/C6/wKiom1a0s7qQukPIAABTVB_Ka4M670.png "style=" float: none; "title=" Grep6.png "alt=" Wkiom1a0s7qqukpiaabtvb_ka4m670.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7A/C6/wKioL1a0tA2R1Z8LAAE5K41Dweo889.png "style=" width : 550px;height:417px; "title=" Grep6-1.png "height=" 417 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiol1a0ta2r1z8laae5k41dweo889.png "/>


This article is from the "11160930" blog, please be sure to keep this source http://11170930.blog.51cto.com/11160930/1741277

2016-2-5 Linux Basic Learning 11

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.