The notation:
-k field_start[
type][
,field_end[
type]]
shall define a key field that begins at field_start and ends at
field_end inclusive, unless field_start falls beyond the end of
the line or after field_end, in which case the key field is
empty. A missing field_end shall mean the last character of the
line.
A field comprises a maximal sequence of non-separating characters
and, in the absence of option -t
, any preceding field separator.
The field_start portion of the keydef option-argument shall have
the form:
field_number[
.first_character]
Fields and characters within fields shall be numbered starting
with 1. The field_number and first_character pieces, interpreted
as positive decimal integers, shall specify the first character
to be used as part of a sort key. If .first_character is omitted,
it shall refer to the first character of the field.
The field_end portion of the keydef option-argument shall have
the form:
field_number[
.last_character]
The field_number shall be as described above for field_start.
The last_character piece, interpreted as a non-negative decimal
integer, shall specify the last character to be used as part of
the sort key. If last_character evaluates to zero or
.last_character is omitted, it shall refer to the last character
of the field specified by field_number.
If the -b
option or b
type modifier is in effect, characters
within a field shall be counted from the first non-<blank> in the
field. (This shall apply separately to first_character and
last_character.)