比较Linux中匹配单词的两个文件

时间:2021-10-06 16:02:10

Lets say we have two files as follows

可以说我们有两个文件如下

File A.txt

Karthick is not so intelligent He is not lazy

Karthick并不那么聪明他并不懒惰

File B.txt

karthick is not so bad either He is hard worker

卡西克并不是那么糟糕,他也很努力

so in the two files above, the commone words are "karthick is not so" & "He is" in each of the lines. Is there any way to print all such common lines with either grep command or some linux command?

所以在上面的两个文件中,普通话在每一行中都是“karthick is not so”和“他是”。有没有办法用grep命令或一些linux命令打印所有这些公共行?

1 个解决方案

#1


6  

You want to use the dwdiff utility :).

你想使用dwdiff实用程序:)。

Example usage:

dwdiff "File A.txt" "File B.txt"

It might take a little while to get used to it's output, but check http://linux.die.net/man/1/dwdiff for more details on that.

可能需要一段时间才能习惯它的输出,但请查看http://linux.die.net/man/1/dwdiff以获取更多详细信息。

There are also several visual diff applications out there, but I prefer using it on the command line.

还有一些视觉差异应用程序,但我更喜欢在命令行上使用它。

#1


6  

You want to use the dwdiff utility :).

你想使用dwdiff实用程序:)。

Example usage:

dwdiff "File A.txt" "File B.txt"

It might take a little while to get used to it's output, but check http://linux.die.net/man/1/dwdiff for more details on that.

可能需要一段时间才能习惯它的输出,但请查看http://linux.die.net/man/1/dwdiff以获取更多详细信息。

There are also several visual diff applications out there, but I prefer using it on the command line.

还有一些视觉差异应用程序,但我更喜欢在命令行上使用它。