Is there a mac file comparison tool that can detect duplicates within a file? This is very close to what I'm looking for except it is for Windows: http://www.rlvision.com/dupli/about.asp. Also, I need to compare duplicate content across two files. If nothing else, I can just append file2 content to the bottom of file1.
Remove duplicate lines with uniq If you don't need to preserve the order of the lines in the file, using the sort and uniq commands will do what you need in a very straightforward way. The sort command sorts the lines in alphanumeric order. The uniq command ensures that sequential identical lines are reduced to one.
Uniq command is helpful to remove or detect duplicate entries in a file.
Explanation: uniq : Removes duplicate lines.
I don't know of a GUI app to do it, but it's fairly easy at the terminal:
cat file1.txt file2.txt | sort | uniq -d
The -d
will make it show only duplicate lines. If you just want the output without duplicates, just leave off the -d
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With