I have two files containing list of all files paths from two hard drives (supposed to be exactly the same), one of which I think has missing files. Both lists have the file path and size, but the lists are not in the same order (see example below).
Is there a command which can compare the difference between the two files and output the difference to a new file?
Example:
file1:
/docs/red
/docs/blue
/docs/yellow
/docs/green
file_2:
/docs/blue
/docs/green
/docs/red
Difference_File:
/docs/yellow
Best Answer
Use
grep
and no need sort them:will return lines which are in file1 but not in file2 (lines missed in file2).