![]() Tabular data handling toolkit |
pjoin(1) - relational join on two files
SYNOPSISpjoin [options] file1 keyfields1 file2 keyfields2DESCRIPTIONpjoin performs a relational join on two sets of whitespace-delimited tabular data records. file1 and file2 are the input files. One of them may be - to indicate that data are to be read from standard input. The result is written to standard output and uses the same field delimitation as the input files. Comment lines (beginning with //) and blank lines are skipped on input and do not appear in output.
keyfields1 specifies one or more fields in file1 to
consider when performing the join; it may be a single field specifier or
a list of field specifiers delimited by commas. Likewise keyfields2 for file2.
Fields may be specified by number, e.g. 2 specifies the second field. If a
file has a
field name header,
field names may be used, e.g. id (however the
-h1 and/or -h2 options must be used so that pjoin knows to expect a field
name header in file1 or file2 respectively).
OPTIONS-l
-r
Note: -l and -r may both be used to produce a loss-less join.
-i
-dup1
-dup2
-q
-rml
-rmr
-H
-h1
-h2
-ho
-t
-fc
NOTESUsing -l anf -r together results in a "loss-less" join.-dup1 and -dup2 cannot be used together.
-rmr and -rml cannot be used together.
EXAMPLESuppose file1 looks like this:001 A red 001 B red 002 A blue 003 C yellowand file2 looks like this: 001 A Jean 002 A JanWe could perform an ordinary join by issuing the command: pjoin file1 1,2 file2 1,2 001 A red 001 A Jean 002 A blue 002 A JanOr we could perform a left join by issuing this command: pjoin -l file1 1,2 file2 1,2 001 A red 001 A Jean 001 B red --- - ---- 002 A blue 002 A Jan 003 C yellow --- - --- AUTHORSteve Grubb, with portions developed by Sandra Reynolds and Marv Newhouse. |
![]() Tabular data handling toolkit Copyright Steve Grubb |