亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標題: 求助匹配模式n至m次的問題 [打印本頁]

作者: qinghan1125    時間: 2010-01-30 14:08
標題: 求助匹配模式n至m次的問題
如下,第二個awk輸出為空,原意是想數(shù)值匹配1至3次

sbmp:/tmp/ou # awk '{if($1~/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/) print $1}' /etc/hosts
127.0.0.1
127.0.0.2
10.69.18.213
192.168.1.113

sbmp:/tmp/ou #  awk '{if($1~/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/) print $1}' /etc/hosts
作者: lululau    時間: 2010-01-30 14:47
awk  --re-interval '$1 ~ /[0-9]{1,3}\.[0-9]......./'
作者: qinghan1125    時間: 2010-01-30 17:59
請教我寫的那個有什么問題呢
作者: wqfhenanxc    時間: 2010-01-30 19:41
標題: 回復 #3 qinghan1125 的帖子
man awk

--re-interval
              Enable the use of interval expressions in regular expression matching (see Regular , Expressionsbelow).  Interval expressions were not traditionally available in the AWK language.  The POSIX standard added them, to make awk and egrep consistent with each other.  However, their use is likely to break old AWK programs, so gawk only provides them if they are requested with this option, or when --posix is specified.
作者: iori809    時間: 2010-01-30 20:36
標題: 回復 #3 qinghan1125 的帖子
其實主要是AWK的版本問題在 POSIX之前的版本大括號不可使用。 之后就可以 了




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2