On 2020-01-04 01:28, Saint Michael wrote: > I am trying to use the comm utility to compare two list of IP addresses, > sorted with regular sort (not -n), and the result is erroneous. I could not > find the answer in Google. > > list1= > 208.78.161.18 > 208.78.161.19 > 208.78.161.20 > 208.78.161.206 > 208.78.161.207 > 208.78.161.21 > 208.78.161.22 > 208.78.161.224 > 208.78.161.226 > 208.78.161.227 > > list2 > 208.78.161.17 > 208.78.161.18 > 208.78.161.19 > 208.78.161.20 > 208.78.161.206 > 208.78.161.207 > 208.78.161.21 > 208.78.161.22 > 208.78.161.224 > 208.78.161.226 > This command should work > comm -12 --check-order <(sort list1.txt) <(sort list2.txt) > my environment > export LC_ALL=C > export LANG=en_US.UTF-8 > export LC_CTYPE="en_US.UTF-8" > export LC_COLLATE=C > > why these lists are no being compared correctly?
Unfortunately, you did not mention the actual output of the above command (and what exactly you think is wrong with it), nor did you mention an error message. Here, it gives (without error): $ comm -12 --check-order <(sort list1.txt) <(sort list2.txt) 208.78.161.18 208.78.161.19 208.78.161.20 208.78.161.206 208.78.161.207 208.78.161.21 208.78.161.22 208.78.161.224 208.78.161.226 which looks good, and BTW is identical with the output of $ sort list1.txt list2.txt | uniq -d Have a nice day, Berny