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

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 2257 | 回復(fù): 7
打印 上一主題 下一主題

awk包含匹配正則表達(dá)式問(wèn)題 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2012-04-19 16:13 |只看該作者 |倒序?yàn)g覽
本帖最后由 mgqw 于 2012-04-19 16:15 編輯

為什么我直接匹配兩個(gè)'+'號(hào) /^\+\+/ 能匹配上,
而用正則表達(dá)式 /^\+{2,}/ 匹配兩次以上就匹配不上了,
為什么呢? 求解釋
  1. $ cat svn.log
  2. +++ xxxconfig.js
  3. +               'xxxSettingInfo'         
  4. +               'xxxChangeSet'           
  5. +++ yyyconfig.js
  6. +               'yyySettingInfo'
  7. +               'yyyChangeSet'

  8. $
  9. $
  10. $ awk '{ if($1~/^\+\+/){print $0} }' ./svn.log  
  11. +++ xxxconfig.js
  12. +++ yyyconfig.js
  13. $
  14. $
  15. $
  16. $ awk '{ if($1~/^\+{2,}/){print $0} }' ./svn.log
  17. $
  18. $
  19. $
復(fù)制代碼

論壇徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亞冠之浦和紅鉆
日期:2015-06-23 19:10:532015亞冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16賽季CBA聯(lián)賽之山東
日期:2016-01-31 18:25:0515-16賽季CBA聯(lián)賽之四川
日期:2016-02-16 16:08:30程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2016-06-29 06:20:002017金雞報(bào)曉
日期:2017-01-10 15:19:5615-16賽季CBA聯(lián)賽之佛山
日期:2017-02-27 20:41:19
2 [報(bào)告]
發(fā)表于 2012-04-19 16:17 |只看該作者
Interval expressions were not traditionally available in awk. They were added as part of the POSIX standard to make awk and egrep consistent with each other.

Initially, because old programs may use ‘{’ and ‘}’ in regexp constants, gawk did not match interval expressions in regexps.

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2012-04-19 16:28 |只看該作者
回復(fù) 2# waker


    版主威武, 這么快就回答了!~

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2012-04-19 16:30 |只看該作者
# echo "+++ abc"|awk --posix '/^\+{2,}/'
+++ abc

論壇徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亞冠之浦和紅鉆
日期:2015-06-23 19:10:532015亞冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16賽季CBA聯(lián)賽之山東
日期:2016-01-31 18:25:0515-16賽季CBA聯(lián)賽之四川
日期:2016-02-16 16:08:30程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2016-06-29 06:20:002017金雞報(bào)曉
日期:2017-01-10 15:19:5615-16賽季CBA聯(lián)賽之佛山
日期:2017-02-27 20:41:19
5 [報(bào)告]
發(fā)表于 2012-04-19 16:32 |只看該作者
說(shuō)明你發(fā)了個(gè)經(jīng)帖

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2012-04-19 16:36 |只看該作者
我有罪......

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2012-04-19 16:40 |只看該作者
       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.

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2012-04-19 17:44 |只看該作者
用--re-interval 參數(shù)可以
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP