- 论坛徽章:
- 780
|
回复 1# Kasiotao
awk要用{n,m}要加--posix或--re-interval- r{n,m} One or two numbers inside braces denote an interval expres-
- sion. 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.
- [backcolor=DarkOrange] Interval expressions are only available if either --posix or
- --re-interval is specified on the command line[/backcolor].
复制代码- [masonzhu@rat122 ~]$ echo -e "smaller\nsmal{2}er"|awk --posix '/l{2}/'
- smaller
- [masonzhu@rat122 ~]$ echo -e "smaller\nsmal{2}er"|awk --re-interval '/l{2}/'
- smaller
复制代码 |
|