- 論壇徽章:
- 0
|
Linux9253 發(fā)表于 2012-04-27 10:31 ![]()
grep -oP '((\d{1,3}\.){3})\d+' ppp
請(qǐng)問這里使用參數(shù)"P"的原因是什么?
是因?yàn)間rep本身對(duì)轉(zhuǎn)義字符類"\d"不支持,需要使用"-P"嗎?因?yàn)間rep對(duì)"\b"或"\B"這種是支持的.- -P, --perl-regexp
- Interpret PATTERN as a Perl regular expression
- The caret ^ and the dollar sign $ are metacharacters that respectively match the empty string at the beginning
- and end of a line. The symbols \< and \> respectively match the empty string at the beginning and end of a
- word. The symbol \b matches the empty string at the edge of a word, and \B matches the empty string provided
- it’s not at the edge of a word.
復(fù)制代碼 |
|