comm:tldr:8c6ed
comm: Print lines only found in second file, when the files aren't sorted.
$ comm -13 <(sort ${file1}) <(sort ${file2})
try on your machine
The command "comm" is used to compare two sorted files line by line. Here is an explanation of the options and arguments used in this particular command:
-
"-13" is a combination of two options: "-1" and "-3".
- "-1" suppresses the lines unique to the first file and only prints lines that are present in both files.
- "-3" suppresses the lines that appear in both files and prints only the lines that are unique to the second file. Thus, the overall effect of this option combination is to print the lines that are unique to the second file.
-
"<(sort ${file1})" and "<(sort ${file2})" are process substitutions in the form of "<(command)".
- "sort ${file1}" sorts the contents of "file1" in alphabetical order. The sorted result is then passed as standard input to the "comm" command using process substitution.
- Similarly, "sort ${file2}" sorts the contents of "file2" in alphabetical order and passes it as standard input to the "comm" command using process substitution.
In summary, the command compares the sorted lines of "file1" and "file2" and prints the lines that are unique to the second file.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.