[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
8.1 cut
: Print selected parts of linesPrint selected parts of lines. 8.2 paste
: Merge lines of filesMerge lines of files. 8.3 join
: Join lines on a common fieldJoin lines on a common field.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cut
: Print selected parts of lines
cut
writes to standard output selected parts of each line of each
input file, or standard input if no files are given or for a file name of
`-'. Synopsis:
cut [option]... [file]... |
In the table which follows, the byte-list, character-list, and field-list are one or more numbers or ranges (two numbers separated by a dash) separated by commas. Bytes, characters, and fields are numbered starting at 1. Incomplete ranges may be given: `-m' means `1-m'; `n-' means `n' through end of line or last field. The list elements can be repeated, can overlap, and can be specified in any order; but the selected input is written in the same order that it is read, and is written exactly once.
The program accepts the following options. Also see 2. Common options.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
paste
: Merge lines of files
paste
writes to standard output lines consisting of sequentially
corresponding lines of each given file, separated by a TAB character.
Standard input is used for a file name of `-' or if no input files
are given.
For example:
$ cat num2 1 2 $ cat let3 a b c $ paste num2 let3 1 a 2 b c |
Synopsis:
paste [option]... [file]... |
The program accepts the following options. Also see 2. Common options.
$ paste -s num2 let3 1 2 a b c |
$ paste -d '%_' num2 let3 num2 1%a_1 2%b_2 %c_ |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
join
: Join lines on a common field
join
writes to standard output a line for each pair of input
lines that have identical join fields. Synopsis:
join [option]... file1 file2 |
Either file1 or file2 (but not both) can be `-', meaning standard input. file1 and file2 should be sorted on the join fields.
Normally, the sort order is that of the
collating sequence specified by the LC_COLLATE
locale. Unless
the `-t' option is given, the sort comparison ignores blanks at
the start of the join field, as in sort -b
. If the
`--ignore-case' option is given, the sort comparison ignores
the case of characters in the join field, as in sort -f
.
However, as a GNU extension, if the input has no unpairable lines the sort order can be any order that considers two fields to be equal if and only if the sort comparison described above considers them to be equal. For example:
$ cat file1 a a1 c c1 b b1 $ cat file2 a a2 c c2 b b2 $ join file1 file2 a a1 a2 c c1 c2 b b1 b2 |
The defaults are: the join field is the first field in each line; fields in the input are separated by one or more blanks, with leading blanks on the line ignored; fields in the output are separated by a space; each output line consists of the join field, the remaining fields from file1, then the remaining fields from file2.
The program accepts the following options. Also see 2. Common options.
A field specification of `0' denotes the join field.
In most cases, the functionality of the `0' field spec
may be reproduced using the explicit m.n that corresponds
to the join field. However, when printing unpairable lines
(using either of the `-a' or `-v' options), there is no way
to specify the join field using m.n in field-list
if there are unpairable lines in both files.
To give join
that functionality, POSIX invented the `0'
field specification notation.
The elements in field-list are separated by commas or blanks. Multiple field-list arguments can be given after a single `-o' option; the values of all lists given with `-o' are concatenated together. All output lines -- including those printed because of any -a or -v option -- are subject to the specified field-list.
In addition, when GNU join
is invoked with exactly one argument,
the `--help' and `--version' options are recognized.
See section 2. Common options.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |