2.7 Emulation

Because of its simularity with join, combine has an emulation
mode that allows you to use the syntax of the join command to start
combine.

The emulation can be started by using ‘--emulate join’ option as the
first option after the command name. After that, you can use the same
options you get with join.

For details of the join command, see See (coreutils.info)join invocation section ‘Join Invocation’ in GNU Coreutils Manual.
When tested against the test cases packaged with GNU Coreutils, results are
identical to join with a couple of exceptions:

The sort order can be different. combine produces records in the order
of the second input file, with any unmatched records from the first input file
following in an arbitrary order.

I change the arguments to the ‘-o’ option in the test script to have
quotes around the field order list when it is separated by spaces. combine
can handle the space-delimited list, but the standard argument handler
getopt_long does not interpret them as a single argument. I don’t see the
need to overcome that.

There is not a specific test, but I have not yet implemented case-insensitive
matching. It would have failed if tested.

One more option that is not implemented in the emulation are the ‘-j1’
and ‘-j2’ methods of specifying separate keys for the two files. Use
‘-1’ and ‘-2’ for that. The two obsolete options would be interpreted
as speciying field 1 or field 2 as the common join key, respectively.

There are also a number of features of combine that come through in the
emulation. The main features relate to the keys: the sort order of the records
in relation to the keys does not matter to combine. combine also
allows you to specify a list of key fields (comma-delimited) rather than just
one as arguments to ‘-1’, ‘-2’, and ‘-j’. You should make
sure that the number of key fields is the same.

Another feature is that the second input file can actually be as many files as
you want. That way you can avoid putting the records from several files together
if not otherwise necessary.