EasyManua.ls Logo

Alcatel-Lucent AOS-W 6.5.3.x - Page 1067

Alcatel-Lucent AOS-W 6.5.3.x
1160 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1067| External Services Interface AOS-W 6.5.3.x| User Guide
n “Regular Expression Repetition Operators” on page513
n “Regular Expression Anchors on page513
n “References” on page514
Character-Matching Operators
Character-matching operators define what the search will match.
Operator Description Sample Result
. Match any one character. grep.ord sample.txt Matches ford, lord, 2ord, etc. in
the file sample.txt.
[] Match any one character listed
between the brackets
grep [cng]ord sample.txt Matches only cord, nord, and
gord
[^] Match any one character not
listed between the brackets
grep [^cn]ord sample.txt Matches lord, 2ord, etc., but
not cord or nord
grep [a-zA-Z]ord
sample.txt
Matches aord, bord, Aord,
Bord, etc.
grep [^0-9]ord sample.txt Matches Aord, aord, etc., but
not 2ord, etc.
Table 259: Character-matching operators in regular expressions
Regular Expression Repetition Operators
Repetition operators are quantifiers that describe how many times to search for a specified string. Use them
in conjunction with the character-matching operators in Table 260 to search for multiple characters.
Operator Description Sample Result
? Match any character one
time if it exists
egrep “?erd” sample text Matches berd, herd, etc., erd
* Match declared element
multiple times if it exists
egrep “n.*rd” sample.txt Matches nerd, nrd, neard, etc.
+ Match declared element one
or more times
egrep “[n]+erd” sample.txt Matches nerd, nnerd, etc., but
not erd
{n} Match declared element
exactly n times
egrep “[a-z]{2}erd”
sample.txt
Matches cherd, blerd, etc., but
not nerd, erd, buzzerd, etc.
{n,} Match declared element at
least n times
egrep “.{2,}erd” sample.txt Matches cherd and buzzerd, but
not nerd
{n,N} Match declared element at
least n times, but not more
than N times
egrep “n[e]{1,2}rd
sample.txt
Matches nerd and neerd
Table 260: Regular expression repetition operators
Regular Expression Anchors
Anchors describe where to match the pattern, and are a handy tool for searching for common string
combinations. Some of the anchor examples use the vi line editor command:s, which stands for substitute.

Table of Contents