Egrep and extended Regular

Source: Internet
Author: User

Mode: pattern

Regular:

grep: Basic Regular

Extended grep: Extending the regular

Basic Regular:

. : Any single character

[]: Within the specified range

[^]: outside the specified range

Number of Matches

*: Characters appear any time

?: Characters appear 0 or 1 times

\{m,n\}: Characters appear at least m times, at most n times

\{1,\}: Characters appear at least 1 times

. *: Matches any character of any length

Anchoring:

^: Anchoring the beginning of the line

$: Anchor Line End

\< or \b: anchoring the word head

\> or \b: Anchor word endings

\(\)

\ (\1): Refers to the contents of a 1th parenthesis

Grep

-I: Ignore case

-V: Reverse Lookup

-O: Show Only strings

--colour: Displays the color

-e: Extended Regular, Egrep

-after 10: Show matching pattern lines, and 10 rows later

-before 10: Display the matching pattern line, and the previous 10 rows

-context 10: Display matching pattern lines, and 10 rows before and after faces

Extended Regular: Egrep

Character Matching:

. : Matches any character

\. Match.

[]

[^]

Number of Matches

*: Any time before the character

? : Its front character 0 or 1 times

+: Match its preceding character at least 1 times

Grep-e ' ^[[:space:]]+ '/boot/grub/grub.conf: At least 1 whitespace characters

{M,n}: characters at least m times, up to N times

Location anchoring:

^

$

\<

\>

Group:

(),

\1

Or

A|b:a or B

C|cat:c or Cat

Egrep and extended regular

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.