The bracket character set in Linux

Source: Internet
Author: User
Tags printable characters

The bracket character set in Linux:


[:d Igit:] numeric characters, 0-9;

[: Lower:] Lowercase alphabetic characters, A-Z;

[: Upper:] Uppercase characters, A-Z;

[: Alpha:] Uppercase and lowercase alphabetic characters, a-za-z;

[: Alnum:] numbers, alphabetic characters, 0-9a-za-z;

[: Space:] Blank (whitespace) character;


[: Blank:] Space (space) and Positioning (tab) characters;

[: Graph:] non-whitespace (nospace) characters;

[:p UNCT:] punctuation characters;

[:p rint:] printable characters;

[: Cntrl:] control character;

[: xdigit:] hexadecimal character;


Test file:

[email protected] ~]# cat test 123123 abcabc #此行有空格; abc123abc ABC abcABC123 123 ABCA,B.C #此行无空格; AAbb.


Example 1:[:d igit:] numeric character, 0-9;

[[email protected] ~]# grep ' [[:d igit:] ' test 123123 abcabc123abc123 123 AbC

Example 2:[:lower:] Lowercase alphabetic characters, A-Z;

[[email protected] ~]# grep ' [[: Lower:] ' test 123 ABCABC ABC123ABC ABC 123 Abca,b.caabb.

Example 3:[:upper:] Uppercase characters, A-Z;

[[email protected] ~]# grep ' [[: Upper:] ' test abc abc abcABC123 123 Abcaabb.

Example 4:[:alpha:] Uppercase and lowercase alphabetic characters, a-za-z;

[[email protected] ~]# grep ' [[: Alpha:]] ' test 123 abcabc abc123abc ABC abcABC123 123 Abca,b.caabb.

Example 5:[:alnum:] numbers, alphabetic characters, 0-9a-za-z;

[[email protected] ~]# grep ' [[: Alnum:] ' test 123123 abcabcabc123abc ABC abcABC123 123 Abca,b.caabb.

Example 6:[:space:] Blank (whitespace) character;

[[email protected] ~]# grep ' [[: Space:]] ' test 123 ABC abc abc ABC 123 ABC

Example 7:[:blank:] Space (space) and Positioning (tab) characters;

[[email protected] ~]# grep ' [[: Blank:]] ' test 123 ABC abc abc ABC 123 ABC

Example 8:[:graph:] Non-whitespace (nospace) characters;

[[email protected] ~]# grep ' [[: Graph:]] ' test 123123 abcabcabc123abc ABC abcABC123 123 Abca,b.caabb.

Example 9:[:p UNCT:] punctuation characters;

[[email protected] ~]# grep ' [[:p UNCT:] ' Test A,b.caabb.

This article is from the "Ilinux" blog, make sure to keep this source http://shenzhijin.blog.51cto.com/1741240/1865291

The bracket character set in Linux

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.