'How to compare two files and delete the difference
I have two Linux directories which are essentially backups and are kind of duplicates with minor changes, I want to compare two the files and delete the difference.
For example: I have two directories.
/root/backup/2022-04-15/CS2-VM (contents:file1.txt)
/root/backup/2022-04-16/CS2-VM (contents:file1.txt , file2.txt)
I want a way to delete file1.txt because they are duplicates, how can this be done in Linux?
Solution 1:[1]
you can use the comm -12 file1 file2 | uniq
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abdelkader Amine Karbache |
