很多人问我awk正则表达式{}该怎么使用,总是不生效,其实看看man文档就知道了,需要加--posix参数就可以了。
下面是man文档中的解释:
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.
Interval expressions are only available if either --posix or
--re-interval is specified on the command line.
阅读(1475) | 评论(0) | 转发(0) |