Linux Shell Example (ii)

Source: Internet
Author: User

First, regular expression
A, the basic regular expression

Meta character Description
. Match any single character
* Match any of its preceding characters any time
.* Any character of any length
[] Matches any single character within the specified range
[^] Matches any single character outside the specified range
[: Lower:] lowercase letters
[: Upper:] Capital
[: Alpha:] All letters
[:d Igit:] Digital
[: Alnum:] All numbers and letters
[:p UNCT:] Punctuation
[: Space:] White space characters
\? Match its preceding character 1 or 0 times
{M,n} Matches the preceding character at least m times, up to N times
^ Riveting the beginning of the line, any content after this character must appear at the beginning of the line
$ Rivet line end, any content in front of this character must appear at the end of the row
^$ Represents a blank line
\< or \b The first of the riveting word, any character after it must appear as the header of the word
\> or \b A riveting ending, any character in front of which must appear as the tail of a word
() Group
(AB) * AB as a whole, can appear any time
(AB). *\1 Refers to the first opening parenthesis and all the contents of the corresponding closing parenthesis
(AB). *\2 Refers to the second opening parenthesis and all the contents of the corresponding closing parenthesis

B. Extend the entire expression

. match any single character
[] Matches any single character within the specified range
[^] Matches any single character outside the specified range
* Match its preceding characters any time
? Match its first character 0 or 1 times
+ Match its preceding character at least 1 times, similar to the basic regular expression {1,}
{M,n} Matches the preceding character at least m times, up to N times
^ Header
$ End of Line
\< or \b Word Head
\> or \b Ending

C, examples
CP one copy of/etc/passwd file to/tmp

Linux Shell Example (ii)

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.