diff options
author | Pádraig Brady <P@draigBrady.com> | 2011-01-05 11:52:54 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2011-01-29 23:08:31 +0000 |
commit | d4db0cb1827730ed5536c12c0ebd024283b3a4db (patch) | |
tree | 091f857d1f547e9468501d14fc58291d2092b27e /doc | |
parent | 68a734d66bbe72d5d4133c386fa77069dd77fb8c (diff) | |
download | coreutils-d4db0cb1827730ed5536c12c0ebd024283b3a4db.tar.xz |
join: add -o 'auto' to output a constant number of fields per line
Lines with a different number of fields than the first line,
will be truncated or padded.
* src/join.c (prfields): A new function refactored from prjoin(),
to output all but the join field.
(prjoin): Don't swap line1 and line2 when line1 is blank
so that the padding is applied to the right place.
(main): Handle the -o 'auto' option.
* tests/misc/join: Add 6 new cases to test the auto format.
* NEWS: Mention the change in behavior.
Suggestion from Assaf Gordon
Diffstat (limited to 'doc')
-rw-r--r-- | doc/coreutils.texi | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index ebe379eb6..d6e98c6d6 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -5701,8 +5701,8 @@ Do not check that both input files are in sorted order. This is the default. @item -e @var{string} @opindex -e -Replace those output fields that are missing in the input with -@var{string}. +Replace those output fields that are missing in the input with @var{string}. +I.E. missing fields specified with the @option{-12jo} options. @item --header @opindex --header @@ -5733,10 +5733,17 @@ Join on field @var{field} (a positive integer) of file 2. Equivalent to @option{-1 @var{field} -2 @var{field}}. @item -o @var{field-list} -Construct each output line according to the format in @var{field-list}. -Each element in @var{field-list} is either the single character @samp{0} or -has the form @var{m.n} where the file number, @var{m}, is @samp{1} or -@samp{2} and @var{n} is a positive field number. +@itemx -o auto +If the keyword @samp{auto} is specified, infer the output format from +the first line in each file. This is the same as the default output format +but also ensures the same number of fields are output for each line. +Missing fields are replaced with the @option{-e} option and extra fields +are discarded. + +Otherwise, construct each output line according to the format in +@var{field-list}. Each element in @var{field-list} is either the single +character @samp{0} or has the form @var{m.n} where the file number, @var{m}, +is @samp{1} or @samp{2} and @var{n} is a positive field number. A field specification of @samp{0} denotes the join field. In most cases, the functionality of the @samp{0} field spec |