|
|
1.1 ! root 1: .\" Copyright (c) 1990 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" Redistribution and use in source and binary forms are permitted provided ! 5: .\" that: (1) source distributions retain this entire copyright notice and ! 6: .\" comment, and (2) distributions including binaries display the following ! 7: .\" acknowledgement: ``This product includes software developed by the ! 8: .\" University of California, Berkeley and its contributors'' in the ! 9: .\" documentation or other materials provided with the distribution and in ! 10: .\" all advertising materials mentioning features or use of this software. ! 11: .\" Neither the name of the University nor the names of its contributors may ! 12: .\" be used to endorse or promote products derived from this software without ! 13: .\" specific prior written permission. ! 14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 17: .\" ! 18: .\" @(#)join.1 6.3 (Berkeley) 7/24/90 ! 19: .\" ! 20: .Dd July 24, 1990 ! 21: .Dt JOIN 1 ! 22: .Os BSD 4.4 ! 23: .Sh NAME ! 24: .Nm join ! 25: .Nd relational database operator ! 26: .Sh SYNOPSIS ! 27: .Nm join ! 28: .Op Fl a Ar file_number ! 29: .Op Fl e Ar string ! 30: .Op Fl j Ar file_number field ! 31: .if n .br ! 32: .Op Fl o Ar list ! 33: .Op Fl t Ar char ! 34: .Op Fl v Ar file_number ! 35: .Ob ! 36: .Fl \&1 ! 37: .Ar field ! 38: .Oe ! 39: .Ob ! 40: .Fl \&2 ! 41: .Ar field ! 42: .Oe ! 43: .Ar file1 ! 44: .if n .br ! 45: .Ar file2 ! 46: .Sh DESCRIPTION ! 47: The join utility performs an ``equality join'' on the files ! 48: .Ar file1 ! 49: and ! 50: .Ar file2 . ! 51: The joined files are written to the standard ! 52: output. ! 53: .Pp ! 54: The ``join field'' is a field in each file on which the ! 55: files are compared. ! 56: There is one line in the output for ! 57: each pair of lines in ! 58: .Ar file1 ! 59: and ! 60: .Ar file2 ! 61: which have identical ! 62: join fields. ! 63: The output line by default consists of the ! 64: join field, then the remaining fields from ! 65: .Ar file1 , ! 66: then the ! 67: remaining fields from ! 68: .Ar file2 . ! 69: This format can be changed by ! 70: using the ! 71: .Fl o ! 72: option (see below). ! 73: .Pp ! 74: The files file1 and file2 should be ordered in the collating ! 75: sequence of ! 76: .Li sort -b ! 77: on the fields on which they are to be ! 78: joined, by default the first in each line; Otherwise, all ! 79: join field matches need not be reported. ! 80: .Pp ! 81: The default input field separators are <blank>s. ! 82: In this ! 83: case, multiple separators count as one field separator, and ! 84: leading separators are ignored. ! 85: The default output field ! 86: separator is a <space>. ! 87: .Pp ! 88: The following options are available: ! 89: .Tw Fl ! 90: .Tc Fl a ! 91: .Ws ! 92: .Ar file_number ! 93: .Cx ! 94: In addition to the default output, produce a line ! 95: for each unpairable line in file ! 96: .Ar file_number , ! 97: where ! 98: .Ar file_number ! 99: is 1 or 2. ! 100: .Tc Fl e ! 101: .Ws ! 102: .Ar string ! 103: .Cx ! 104: Replace empty output fields by the string ! 105: .Ar string . ! 106: .Tc Fl j ! 107: .Ws ! 108: .Ar file_number field ! 109: .Cx ! 110: Join on the ! 111: .Sf Ar field 'th ! 112: field of file ! 113: .Ar file_number . ! 114: If ! 115: .Ar file_number ! 116: is missing, (i.e., the ! 117: first digit of the option argument is neither 1 nor ! 118: 2), use the ! 119: .Sf Ar field 'th ! 120: field in each file. ! 121: Fields are ! 122: decimal integers starting with 1. ! 123: .Tc Fl o ! 124: .Ws ! 125: .Ar list ! 126: .Cx ! 127: Each output line comprises the fields specified in ! 128: .Ar list , ! 129: each element of which has the form ! 130: .Ql file_number.field , ! 131: where ! 132: .Ar file_number ! 133: is a file ! 134: number and field is a decimal integer field number. ! 135: The elements of list are either comma or <space> separated. ! 136: The list is written only for lines with matching join fields, ! 137: and is not output unless specifically requested. ! 138: .Tc Fl t ! 139: .Ws ! 140: .Ar char ! 141: .Cx ! 142: Use character ! 143: .Ar char ! 144: as a separator, for both input ! 145: and output. ! 146: Every appearance of char in a line is ! 147: significant. ! 148: When this option is specified, the ! 149: collating sequence should be the same as sort ! 150: without the ! 151: .Fl b ! 152: option. ! 153: .Tc Fl v ! 154: .Ws ! 155: .Ar file_number ! 156: .Cx ! 157: Instead of the default output, produce a line only ! 158: for each unpairable line in ! 159: .Ar file_number , ! 160: where ! 161: .Ar file_number ! 162: is 1 or 2. ! 163: .Tc Fl 1 ! 164: .Ws ! 165: .Ar field ! 166: .Cx ! 167: Join on the ! 168: .Sf Ar field 'th ! 169: field of file 1. ! 170: Fields are ! 171: decimal integers starting with 1. ! 172: .Tc Fl 2 ! 173: .Ws ! 174: .Ar field ! 175: .Cx ! 176: Join on the ! 177: .Sf Ar field 'th ! 178: field of file 2. ! 179: Fields are ! 180: decimal integers starting with 1. ! 181: .Tp ! 182: .Pp ! 183: If both ! 184: .Ql \-a 1 ! 185: and ! 186: .Ql \-a 2 ! 187: are specified, both sets of information ! 188: are output, ! 189: .Ql \-a 2 ! 190: always first, regardless of the specified ! 191: order. ! 192: .Pp ! 193: The following arguments are required: ! 194: .Dw Fl ! 195: .Di L ! 196: .Dp Ar file1 ! 197: .Dp Ar file2 ! 198: A pathname of a file to be joined. ! 199: If either of ! 200: the ! 201: .Ar file1 ! 202: or ! 203: .Ar file2 ! 204: arguments is ! 205: .Sq Fl ! 206: the standard ! 207: input is used in its place. ! 208: .Dp ! 209: .Pp ! 210: The ! 211: .Nm join ! 212: utility exits 0 on success, and >0 if an error occurs. ! 213: .Sh STANDARDS ! 214: The ! 215: .Nm join ! 216: function is expected to be POSIX 1003.2 compatible. ! 217: .Sh SEE ALSO ! 218: .Xr awk 1 ! 219: .Xr comm 1 , ! 220: .Xr look 1 ! 221: .Xr sort 1 , ! 222: .Xr uniq 1 , ! 223: .Sh BUGS ! 224: The conventions of ! 225: .Nm ! 226: .Xr join 1 , ! 227: .Xr comm 1 , ! 228: .Xr sort 1 , ! 229: .Xr uniq 1 , ! 230: .Xr look 1 ! 231: and ! 232: .Xr awk 1 ! 233: are wildly incongruous.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.