Search code examples
macosunixdiffbsdcomm

Is the comm command broken on Mac?


Suppose there are file1:

1
2
3
5

And file2:

2
3
4

When comparing them with comm file1 file2 on FreeBSD or Linux, I got the following result:

1
                2
                3
        4
5

But when I tried the same command on Mac OSX 10.9, the result surprised me:

1
        2
        3
    4

Is the comm command broken on Mac? Or am I missing something?


Solution

  • Works correctly on my Mavericks based iMac:

    iMac:~/tmp: cat file1
    1
    2
    3
    5
    iMac:~/tmp: cat file2
    2
    3
    4
    iMac:~/tmp: comm file[12]
    1
        2
        3
        4
    5