Learning record for grep tool under CentOS

Source: Internet
Author: User
Tags alphabetic character control characters printable characters uppercase character alphanumeric characters

One, grep tool quick Find table

grep standard regular correlation meta-character representation and its meaning:

form Description
. This is an English point number. matches any single character;
[] Represents any single character in the specified range;
[^] Represents any single character outside the specified range;
* Indicates that the preceding entry is matched 0 or more times;
. * Any character that matches any length;
\? Indicates that the match precedes the entry at most once, both 0 or 1 times;
\+ Represents 1 or more occurrences of an entry in front of a match;
\{n\} Indicates that the match precedes the entry n times, more than n times, less than n times is not feasible;
\{n,\} Indicates that the match precedes the entry n times or more than n times, which is greater than or equal to n times;
\{,m\} Indicates that the entry in front of the match is at most m times, less than or equal to M; (GNU extension usage )
\{n,m\} Indicates that the entry in front of the match is at least N times, at most m times, containing N and M and m greater than or equal to N;
a\| B Represents part A or part B;
\(...\) Represents a grouping, which can then be used \num to reference the contents of the grouping, NUM represents the number;
^ The caret is the beginning of the anchor line, which can be understood as a match to an empty string (empty string);
$ The dollar symbol indicates the end of the anchor line, which can be understood as a match to an empty string (empty string);
^$ Represents a matching blank line;
\< Indicates the first anchor of the word word, which can be understood as an empty string matching to the first word (empty string);
\> Indicates the word ending anchor, which can be understood as an empty string matched to the ending of the word (empty string);
\b An anchor that represents the boundary of a word, which can be substituted for \< or \>, which can be understood as an empty string matched to the boundary of a word (empty string);
\b Represents an empty string that matches a word boundary (empty string);
\w It is generally understood to be synonymous with [_[:alnum:]], which means matching underscores and alphanumeric characters;
\w It can be understood as synonymous with [^_[:alnum:]], which means a character that matches an underscore, an alphanumeric character;
[: Alnum:] Represents an alphanumeric character, using the form [[: Alnum:]], if you want to exclude, you can match the caret [^[:alnum:]];
[: Alpha:] Represents an alphabetic character, using the form [[: Alpha:]], if you want to exclude, you can match the caret [^[:alpha:]];
[: Cntrl:] Represents the control character, using the form [[: Cntrl:]] After the article has resolved why the control character, not commonly used. If you want to exclude, [^[:cntrl:]];
[:d Igit:] Represents a numeric character, using the form [[:d igit:]]. If you want to exclude, [^[:d igit:]];
[: Graph:] Represents printable and visible characters, followed by annotations. Use form, [[: Graph:]], not commonly used. If you want to exclude, [^[:graph:]];
[: Lower:] Represents a lowercase alphabetic character, using the form [[: Lower:]], if you want to exclude, [^[:lower:]];
[:p rint:] Represents printable characters, using the form [[:p rint:]], excluding, [^[:p rint:]];
[:p UNCT:] Represents the punctuation character, using the form [[:p UNCT:]], excluding, [^[:p UNCT:]]; (except for literal characters [can be interpreted as letters], numbers, control characters, characters other than space characters)
[: Space:] Space character, use form [[: Space:]], there are spaces, page feeds, line feeds, carriage returns, transverse tabs, vertical tabs; exclude [^[:space:]];
[: Upper:] Denotes an uppercase character, using the form [[: Upper:]], excluding, [^[:upper:]];
[: Xdigit:] Represents 16 binary numeric characters, using the form [[: Xdigit:]], excluding, [^[:xdigit:]];
[: Blank:] Represents a space or transverse tab character, using the form [[: Blank:]], excluding, [^[:blank:]];

grep extends the regular related metacharacters representation and its meaning:

Not to be continued ...

Learning record for grep tool under CentOS

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.