Update grep.md (#130)
add -P Perl regular expressions are nearly identical to Python regex
This commit is contained in:
parent
d77b977f9d
commit
1443022790
|
|
@ -28,6 +28,7 @@ grep
|
|||
-l --file-with-matches # 列出文件内容符合指定的范本样式的文件名称。
|
||||
-L --files-without-match # 列出文件内容不符合指定的范本样式的文件名称。
|
||||
-n --line-number # 在显示符合范本样式的那一列之前,标示出该列的编号。
|
||||
-P --perl-regexp # PATTERN 是一个 Perl 正则表达式
|
||||
-q --quiet或--silent # 不显示任何信息。
|
||||
-R/-r --recursive # 此参数的效果和指定“-d recurse”参数相同。
|
||||
-s --no-messages # 不显示错误信息。
|
||||
|
|
@ -95,6 +96,12 @@ grep -E "[1-9]+"
|
|||
# 或
|
||||
egrep "[1-9]+"
|
||||
```
|
||||
使用正则表达式 **-P** 选项:
|
||||
|
||||
```shell
|
||||
grep -P "(\d{3}\-){2}\d{4}" file_name
|
||||
```
|
||||
|
||||
|
||||
只输出文件中匹配到的部分 **-o** 选项:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue