Linux grep command notes and linuxgrep command notes

Source: Internet
Author: User

Linux grep command notes and linuxgrep command notes

Grep
-I is case insensitive.
-- Color add color
Alias grep = grep 'grep -- color
-V: displays the rows not matched by the pattern.
-O only displays the strings matched by the pattern

Review:
* Any character of any length
? Any single character
[] Within the specified range
[^] Out of the specified range

Regular EXPression: Regular EXPression, (REGEXP)
Metacharacters:
. Match any single character
* Match any character before it (Greedy Mode)
.*
? Match the first character once or 0 times (\)
\ {M, n \} matches the first character at least m times, n times
Example: \ {1, \ }\{, 3 \}
^ Pin the beginning of a line
$ Pin the end of a row
^ $ Blank line
[] Matching any single character in a specified range
[^] Match any single character out of the specified range
[: Digit:] Number
[: Lower:] lowercase letters
[: Upper:] uppercase letters
[: Punct:] punctuation marks
[: Space:] blank characters

\ <Or \ B anchor specifies the beginning of a word. Any character after it must appear as the first word.
\> Or \ B anchor determines the end of the word. Any character before it must appear as the end of the word.
Example: \ <root \>
\ (\) Group
Example: \ (AB \)*
\ 1 reference the first left brace and the content in the corresponding right Brace
Example: \ (l. e \). * \ 1

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.