【问题标题】:ngrep how to make match expression case insensitive?ngrep 如何使匹配表达式不区分大小写?
【发布时间】:2015-06-25 09:31:10
【问题描述】:

从手册页引用

match expression
A  match  expression  is either an extended regular expression, or if the -X
option is specified, a string signifying a hexadecimal value.   An  extended
regular  expression  follows  the  rules  as  implemented  by  the GNU regex
library.  Hexadecimal expressions can optionally be preceded by `0x'.  E.g.,
`DEADBEEF', `0xDEADBEEF'.

对于(e)grep,我使用-i,但是如何编写不区分大小写的ngrep匹配表达式?

例如

sudo ngrep -xqtd lo0 select port 3306

不会匹配mysql --protocol=tcp -e "Select 1"

【问题讨论】:

  • 你引用了什么手册页? ngrep?此外,在softpanorama.org/Net/Netutils/ngrep.shtmlngrep.sourceforge.net/usage.html 中,他们都提到了-i 选项。如果你使用它,你会得到什么?
  • 对不起,我错过了,当我查看手册页时,我搜索了 insensitive,但我应该搜索大小写我会找到 -i 选项。这个问题没用,我应该删除它吗?
  • 不,它可能对下一个检查它的人有好处。我会发布一个答案来说明清楚。

标签: regex linux bash shell grep


【解决方案1】:

man page 中所述,您可以使用-i 选项:

-i

执行不区分大小写的搜索。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-05
    • 1970-01-01
    相关资源
    最近更新 更多