- 论坛徽章:
- 23
|
回复 10# Leo_Li02
man awk
r{n}
r{n,}
r{n,m} One or two numbers inside braces denote an interval expression. If there is one number in the braces, the preceding regular expression r is
repeated n times. If there are two numbers separated by a comma, r is repeated n to m times. If there is one number followed by a comma,
then r is repeated at least n times.
Interval expressions are only available if either --posix or --re-interval is specified on the command line.- echo $var | awk --posix '$1~/[0-9]{6}/{print "matches"}'
复制代码 |
|