[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What is the 'associated field'? (about sort)

From: Peng Yu
Subject: What is the 'associated field'? (about sort)
Date: Fri, 1 Jul 2011 20:22:59 -0500


The following explanation for coreutils manual is not very clear.

"Also note that the ‘n’ modifier was applied to the field-end
specifier for the first key. It
would have been equivalent to specify ‘-k 2n,2’ or ‘-k 2n,2n’. All
modifiers except ‘b’
apply to the associated field, regardless of whether the modifier
character is attached
to the field-start and/or the field-end part of the key specifier."

According to the manual and the following output, '-k 1,2n' is the
same as '-k 1n,2' and '-k 1n,2n'. But isn't this syntax a little
confusing? Shouldn't '-k 1n,2n' be the same as '-k1,1n -k2,2n'?

Also I don't understand what "associated field" refers to?

> cat input1.txt
1 10
1 9
> sort --key=1,2n input1.txt
1 10
1 9
> sort --key=1n,2n input1.txt
1 10
1 9
> sort --key=1,1n --key=2,2n input1.txt
1 9
1 10


reply via email to

[Prev in Thread] Current Thread [Next in Thread]