Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.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
Linux Grep命令-ov标志_Linux_Grep - Fatal编程技术网

Linux Grep命令-ov标志

Linux Grep命令-ov标志,linux,grep,Linux,Grep,我在玩grep命令,我注意到grep-ovunixgeekfile.txt不起作用。 另一方面,grep-ov unix Geekfile.txt打印结果 我的Geekfile.txt是 Unix is great os. unix is opensource. unix is free os. learn operating system. Unix linux which one you choose. uNix is easy to learn. unix is a multiuser

我在玩grep命令,我注意到
grep-ovunixgeekfile.txt
不起作用。 另一方面,
grep-ov unix Geekfile.txt
打印结果

我的Geekfile.txt是

Unix is great os. 
unix is opensource. 
unix is free os.
learn operating system.
Unix linux which one you choose.
uNix is easy to learn.
unix is a multiuser os.
Learn unix .
unix is a powerful
它不应该像这样打印其余的行吗:-

learn operating system.
Unix linux which one you choose.
uNix is easy to learn.

此选项不能同时使用

  • -o、 --仅匹配仅显示线条匹配图案的一部分`
  • -v、 --反转匹配选择不匹配的线
您不能说您应该使用
-v
获得唯一匹配,然后将其倒置
-o
。它不会合并

grep -o unix file
unix
unix
unix
unix
unix


这两个命令是相同的。编辑您的问题以修复它,并解释什么是“不工作”
grep -v unix file
Unix is great os.
learn operating system.
Unix linux which one you choose.
uNix is easy to learn.