Reputation: 23
I want to find duplicates between two folders based on lists with checksums.
A solution with some shell script (some bash, awk or similar) would be best.
Assume that for the two folders I have already generated two lists
[FolderA.txt]
file1 abc1
file2 abc1
file3 def5
and
[FolderB.txt]
file4 abc1
file5 mno2
file6 def5
Now I want to find out, that
However, I only want matches between folders, not within one folder. Hence, I do NOT want a match between file1 and file2.
Upvotes: 2
Views: 104
Reputation: 88889
You can use this:
join -j2 <(sort -k2 FolderA.txt) <(sort -k2 FolderB.txt)
Output:
abc1 file1 file4 abc1 file2 file4 def5 file3 file6
If you want only column 2 and 3, add | cut -d " " -f 2-
Upvotes: 2