Pattern-Matching Characters
The material in this section is adapted from the Bash Reference Manual (http://www.gnu.org/software/bash/manual/bashref.html; see Pattern-Matching Characters).
Table A-19. Pattern-matching characters
Character | Meaning |
|---|---|
* | Matches any string, including the null string. |
? | Matches any single character. |
[ … ] | Matches any one of the enclosed characters. |
[! … ] or [^ … ] | Matches any character not enclosed. |
The following POSIX character classes may be
used within [], e.g., [[:alnum:]];
consult the grep or egrep
manpage on your system for more details.
[[:alnum:]] [[:alpha:]] [[:ascii:]] [[:blank:]] [[:cntrl:]] [[:digit:]] [[:graph:]] [[:lower:]] [[:print:]] [[:punct:]] [[:space:]] [[:upper:]] [[:word:]] [[:xdigit:]]
The word character class matches
letters, digits, and the character _.
[=c=] matches all characters with
the same collation weight (as defined by the current locale) as the
character c, while
[.symbol.] matches the collating symbol
symbol.
These character classes are affected by the locale setting. To get
the traditional Unix values, use LC_COLLATE=C or LC_ALL=C.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access