我想使用Linuxdiff
命令以获得以下输出:
2,4c2,4
我只想知道文件不同的行号。我不想要控制台上的实际行。
Eg:
如果我执行以下命令:diff file1.txt file2.txt
我想要以下输出:
2,4c2,4
我不想要输出:
2,4c2,4
< I need to run the laundry.
< I need to wash the dog.
< I need to get the car detailed.
---
> I need to do the laundry.
> I need to wash the car.
> I need to get the dog detailed.
我浏览了手册diff
命令,但我找不到任何选项可以让我实现我想要的。
通过管道将其传输到grep
并且只显示以数字开头的行。
diff file1.txt file2.txt | grep '^[1-9]'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)