How to do the opposite of diff? [duplicate]

吃可爱长大的小学妹 提交于 2019-12-02 20:41:21

Here is a solution that WILL NOT change the order of the lines:

fgrep -x -f file1 file2

Use the join command:

join a.txt b.txt

assuming the files are sorted; if not:

sort a.txt > sorted_a.txt; sort b.txt > sorted_b.txt; join sorted_a.txt sorted_b.txt
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!