|
|
1.1 ! root 1: .TH JOIN 1 ! 2: .CT 1 files ! 3: .SH NAME ! 4: join \(mi relational database operator ! 5: .SH SYNOPSIS ! 6: .B join ! 7: [ ! 8: .I options ! 9: ] ! 10: .I file1 file2 ! 11: .SH DESCRIPTION ! 12: .I Join ! 13: forms, on the standard output, ! 14: a join ! 15: of the two relations specified by the lines of ! 16: .I file1 ! 17: and ! 18: .IR file2 . ! 19: If ! 20: .I file1 ! 21: is ! 22: .LR - , ! 23: the standard input is used. ! 24: .PP ! 25: .I File1 ! 26: and ! 27: .I file2 ! 28: must be sorted in increasing ! 29: .SM ASCII ! 30: collating ! 31: sequence on the fields ! 32: on which they are to be joined, ! 33: normally the first in each line. ! 34: .PP ! 35: There is one line in the output ! 36: for each pair of lines in ! 37: .I file1 ! 38: and ! 39: .I file2 ! 40: that have identical join fields. ! 41: The output line normally consists of the common field, ! 42: then the rest of the line from ! 43: .IR file1 , ! 44: then the rest of the line from ! 45: .IR file2 . ! 46: .PP ! 47: Input fields are normally separated by blank, tab or newline; ! 48: output fields by blank. ! 49: In this case, multiple separators count as one, and ! 50: leading separators are discarded. ! 51: .PP ! 52: These options are recognized: ! 53: .TP ! 54: .BI -a n ! 55: In addition to the normal output, ! 56: produce a line for each unpairable line in file ! 57: .IR n , ! 58: where ! 59: .I n ! 60: is 1 or 2. ! 61: .TP ! 62: .BI -e \ s ! 63: Replace empty output fields by string ! 64: .IR s . ! 65: .TP ! 66: .BI -j n\ m ! 67: Join on the ! 68: .IR m th ! 69: field of file ! 70: .IR n . ! 71: If ! 72: .I n ! 73: is missing, use the ! 74: .IR m th ! 75: field in each file. ! 76: .TP ! 77: .BI -o \ field \ \fR... ! 78: Each output line comprises the named fields, each designated ! 79: as 0, meaning the join field, or as ! 80: .IR n . m , ! 81: where ! 82: .I n ! 83: is a file number and ! 84: .I m ! 85: is a field number. ! 86: .PP ! 87: .TP ! 88: .BI -t c ! 89: Use character ! 90: .I c ! 91: as the only separator (tab character) on input and output. ! 92: Every appearance of ! 93: .I c ! 94: in a line is significant. ! 95: .SH EXAMPLES ! 96: .TP ! 97: .L ! 98: sort /etc/password | join -t: -a1 -e "" - bdays ! 99: Add birthdays to password information, leaving unknown ! 100: birthdays empty. ! 101: The layout of ! 102: .F /etc/passwd ! 103: is given in ! 104: .IR passwd (5); ! 105: .B bdays ! 106: contains sorted lines like ! 107: .LR "ken:Feb\ 4" . ! 108: .TP ! 109: .L ! 110: tr : ' ' </etc/passwd | sort +2 >temp ! 111: .br ! 112: .ns ! 113: .TP ! 114: .L ! 115: join -j1 3 -j2 3 -o 1.1 2.1 temp temp | awk '$1 < $2' ! 116: Print all pairs of users with identical userids. ! 117: .SH "SEE ALSO" ! 118: .IR sort (1), ! 119: .IR comm (1), ! 120: .IR awk (1) ! 121: .SH BUGS ! 122: With default field separation, ! 123: the collating sequence is that of ! 124: .LR "sort\ -b" ; ! 125: with ! 126: .BR -t , ! 127: the sequence is that of a plain sort. ! 128: .br ! 129: The field conventions of ! 130: .I join, sort, comm, uniq, look ! 131: and ! 132: .IR awk (1) ! 133: are wildly incongruent.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.