User's manual. Section 1.

JN(1): join fields


USAGE

        usage: jn [-1Du] [-i isep] [-k1 nb] [-k2 nb] [-o osep] {file}
            -1: fields are separated by one run of the separator string
            -D: debug
            -i isep: input field separator character(s) or string under -1
            -k1 nb: join on this field nb. for 1st file
            -k2 nb: join on this field nb. for 2nd and following files
            -o osep: output field delimiter string
            -u: unix IO
        

DESCRIPTION

Jn joins the lines in input files. Each line is considered as a record, with field numbers counting from 1. The join combines records with the same key in all files. If a key is found in one file, a line is generated for it even if it is not found in any other file. Files need not to be sorted. By default, the first field is used as the key. Flags -k1 and -k2 can be used to set a different key for the first file and for all other files.

By default the field separator is a run of blanks. Flag -F changes the set of runes used as field separators to its argument.

Flag -1 indicates that fields are separated exactly by one instance of the separator string. Such string defaults to a tabulator character in this case, unless -F says otherwise.

The output is printed sorted on the key field. Output fields are separated by default using a tab character or the sep string if -1 is used.

EXAMPLES

Join the lines of ids and all grade files using the first field in ids and the second in others. Generate output fields separated by a : character:

        ; lf -g ids ,~grade | jn -u -k2 2 -o: f1 f2
        

SOURCE

  • /zx/sys/src/clive/cmd/jn

SEE ALSO

  • flds(1) to select fields in output.
  • lns(1) to select lines in output.


User's manual. Section 1.