加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

grep中整字匹配

发布时间:2020-12-15 21:05:50 所属栏目:大数据 来源:网络整理
导读:$ man grep ? ? ? ?-G,--basic-regexp ? ? ? ? ? ? ? Interpret PATTERN as a basic regular expression (BRE,see below). ?This is the default. ? ? ? ?-P,--perl-regexp ? ? ? ? ? ? ? Interpret PATTERN as a Perl regular expression. ?This is highly
$ man grep


? ? ? ?-G,--basic-regexp
? ? ? ? ? ? ? Interpret PATTERN as a basic regular expression (BRE,see below). ?This is the default.


? ? ? ?-P,--perl-regexp
? ? ? ? ? ? ? Interpret PATTERN as a Perl regular expression. ?This is highly experimental and grep -P may
? ? ? ? ? ? ? warn of unimplemented features.


? ?Matching Control
? ? ? ?-e PATTERN,--regexp=PATTERN
? ? ? ? ? ? ? Use ?PATTERN ?as ?the ?pattern. ?This can be used to specify multiple search patterns,or to
? ? ? ? ? ? ? protect a pattern beginning with a hyphen (-). ?(-e is specified by POSIX.)


? ? ? ?-f FILE,--file=FILE
? ? ? ? ? ? ? Obtain patterns from FILE,one per ?line. ? The ?empty ?file ?contains ?zero ?patterns,?and
? ? ? ? ? ? ? therefore matches nothing. ?(-f is specified by POSIX.)


? ? ? ?-i,--ignore-case
? ? ? ? ? ? ? Ignore ?case ?distinctions ?in ?both ?the ?PATTERN and the input files. ?(-i is specified by
? ? ? ? ? ? ? POSIX.)


? ? ? ?-v,--invert-match
? ? ? ? ? ? ? Invert the sense of matching,to select non-matching lines. ?(-v is specified by POSIX.)


? ? ? ?-w,--word-regexp
? ? ? ? ? ? ? Select only those lines containing matches that form whole words. ? The ?test ?is ?that ?the
? ? ? ? ? ? ? matching ?substring ?must ?either be at the beginning of the line,or preceded by a non-word
? ? ? ? ? ? ? constituent character. ?Similarly,it must be either at the end of the line or followed by a
? ? ? ? ? ? ? non-word ?constituent ?character. ? Word-constituent characters are letters,digits,and the
? ? ? ? ? ? ? underscore.


? ? ? ?-x,--line-regexp
? ? ? ? ? ? ? Select only those matches that exactly match the whole line. ?(-x is specified by POSIX.)


? ? ? ?-y ? ? Obsolete synonym for -i.


? ?General Output Control

? ? ? ?-c,--count


查看man手册可以看到:

-w选项就是整字匹配

下面还有个-x选项是整行匹配

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读