|
|
1.1 ! root 1: .TH JOIN 1 ! 2: .CT 1 files ! 3: .SH NAME ! 4: join \- 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 one of the file names is ! 20: .LR - , ! 21: the standard input is used. ! 22: .PP ! 23: .I File1 ! 24: and ! 25: .I file2 ! 26: must be sorted in increasing ! 27: .SM ASCII ! 28: collating ! 29: sequence on the fields ! 30: on which they are to be joined, ! 31: normally the first in each line. ! 32: .PP ! 33: There is one line in the output ! 34: for each pair of lines in ! 35: .I file1 ! 36: and ! 37: .I file2 ! 38: that have identical join fields. ! 39: The output line normally consists of the common field, ! 40: then the rest of the line from ! 41: .IR file1 , ! 42: then the rest of the line from ! 43: .IR file2 . ! 44: .PP ! 45: Input fields are normally separated spaces or tabs; ! 46: output fields by space. ! 47: In this case, multiple separators count as one, and ! 48: leading separators are discarded. ! 49: .PP ! 50: The following options are recognized, with POSIX syntax. ! 51: .TP ! 52: .BI -a " n ! 53: In addition to the normal output, ! 54: produce a line for each unpairable line in file ! 55: .IR n , ! 56: where ! 57: .I n ! 58: is 1 or 2. ! 59: .TP ! 60: .BI -v " n ! 61: Like ! 62: .BR -a , ! 63: omitting output for paired lines. ! 64: .TP ! 65: .BI -e " s ! 66: Replace empty output fields by string ! 67: .IR s . ! 68: .TP ! 69: .BI -1 " m ! 70: .br ! 71: .ns ! 72: .TP ! 73: .BI -2 " m ! 74: Join on the ! 75: .IR m th ! 76: field of ! 77: .I file1 ! 78: or ! 79: .IR file2 . ! 80: .TP ! 81: .BI -j "n m" ! 82: Archaic equivalent for ! 83: .BI - n " m"\f1. ! 84: .TP ! 85: .BI -o fields ! 86: Each output line comprises the designated fields. ! 87: The comma-separated field designators are either ! 88: .BR 0 , ! 89: meaning the join field, or have the form ! 90: .IR n . m , ! 91: where ! 92: .I n ! 93: is a file number and ! 94: .I m ! 95: is a field number. ! 96: Archaic usage allows separate arguments for field designators. ! 97: .PP ! 98: .TP ! 99: .BI -t c ! 100: Use character ! 101: .I c ! 102: as the only separator (tab character) on input and output. ! 103: Every appearance of ! 104: .I c ! 105: in a line is significant. ! 106: .SH EXAMPLES ! 107: .TP ! 108: .L ! 109: sort /adm/users | join -t: -a 1 -e "" - bdays ! 110: Add birthdays to password information, leaving unknown ! 111: birthdays empty. ! 112: The layout of ! 113: .F /adm/users ! 114: is given in ! 115: .IR users (6); ! 116: .B bdays ! 117: contains sorted lines like ! 118: .LR "ken:Feb\ 4,\ 1953" . ! 119: .TP ! 120: .L ! 121: tr : ' ' </adm/users | sort -k 3 3 >temp ! 122: .br ! 123: .ns ! 124: .TP ! 125: .L ! 126: join -1 3 -2 3 -o 1.1,2.1 temp temp | awk '$1 < $2' ! 127: Print all pairs of users with identical userids. ! 128: .SH SOURCE ! 129: .B /sys/src/cmd/join.c ! 130: .SH "SEE ALSO" ! 131: .IR sort (1), ! 132: .IR comm (1), ! 133: .IR awk (1) ! 134: .SH BUGS ! 135: With default field separation, ! 136: the collating sequence is that of ! 137: .BI "sort -b" ! 138: .BI -k y , y\f1; ! 139: with ! 140: .BR -t , ! 141: the sequence is that of ! 142: .BI "sort -t" x ! 143: .BI -k y , y\f1. ! 144: .br ! 145: One of the files must be randomly accessible. ! 146:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.