I have a list of IDs (sorted) in two files and I ran the comm command to compare them, but it seems to miss out one lines common to both files. Why is that?File1:1234567891112131516171819202122File2:16182123705707709711712826827839846847848872873874875891Comm output: $> comm file1 file11    16  //exists in both files    18  //exists in both files2    21    2334567    705    707    709    711    7128    826    827    839    846    847    848    872    873    874    875    89191112131516 //it's here!17 18 //...and here!19202122The files are both sorted. However, my guess is that comm doesn't do numeric comparison and only looks at entries lexicographically? If so, what are some alternatives that I can try for this?
Why does the output of comm fail to show common records?
text processing;comm
comm should tell you that one of the files isnt sorted:comm: file 1 is not in sorted orderIt expects the files to be sorted using the current locales collation order (as determined by LC_COLLATE); it wont accept numerical order.To compare the files, you can pre-sort them (lexicographically as you point out):comm <(sort file1) <(sort file2)If you want the result to be sorted numerically, sort it again:comm <(sort file1) <(sort file2) | sort -nThis produces12345678911121315        1617        181920        2122    23    705    707    709    711    712    826    827    839    846    847    848    872    873    874    875    891