Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 正则表达式问题_Regex_Linux_Grep - Fatal编程技术网

Regex 正则表达式问题

Regex 正则表达式问题,regex,linux,grep,Regex,Linux,Grep,也许这是个新手问题,但我必须问它 一般来说,我理解正则表达式,但我不明白,为什么会这样: ^.{8}[[:blank:]]{2} ^.{8}[[:blank:]]{1} 在这条线上工作: prelink: /lib/libkeyutils-1.2.so: at least one of file's dependencies has changed since prelinking 在此grep命令中: echo "prelink: /lib/libkeyutils-1.2.so: at

也许这是个新手问题,但我必须问它
一般来说,我理解正则表达式,但我不明白,为什么会这样:

^.{8}[[:blank:]]{2}
^.{8}[[:blank:]]{1} 
在这条线上工作:

prelink: /lib/libkeyutils-1.2.so: at least one of file's dependencies has changed since prelinking
在此grep命令中:

echo "prelink: /lib/libkeyutils-1.2.so: at least one of file's dependencies has changed since prelinking" | grep -v '^.\{8\}[[:blank:]]\{2\}'
其中:

The says "beggining of line" The .{8} says "any eight characters" The [[:blank:]]{2} says "any two space characters" 不起作用


谢谢您的介绍。

您正在使用
grep
-v
选项,这会导致打印不匹配的行。卸下
-v
,它将按预期工作

grep --help ... -v, --invert-match select non-matching lines ... 格雷普——救命 ... -v、 --反转匹配选择不匹配的线 ...
谢谢,我确信-v是:“使用正则表达式”@rodnower:不,是“grep”部分的意思D