comm command help

The manual does not cover this very well. What do the following compares will do ?
1) comm -13 file1 file2: will it display what is in file2 not in file1?
2) comm -23 file1 file2: will it display what in 1 but not in 2 ?

Thanks

Hi,

The first example will display lines unique to file2 and the second example will display lines unique to file1, but do remember that is the files are not sorted you will have to use the "--nosort" switch.

Regards

Dave

Both are sorted. When you say unique records unique to file2 , are you saying it will display a unique record from file 2 that are not a match?

Remember that all the -1 -2 -3 operators do is suppress columns.

By default it prints all three pieces of information: lines unique to file 1, lines unique to file 2, and lines common to both. Exclude any columns you don't actually want and it'll print the rest.

Hi,

Yes, if a line is in file2 and not in file1 - then;

davem@darkstar> comm -13 file1 file2

Will print that line.

Regards

Dave

Got it. Thank you very much.