bug-coreutils
[Top][All Lists]
Advanced

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

sort "b" option in pos2 has strange effect


From: Davide Canova
Subject: sort "b" option in pos2 has strange effect
Date: Fri, 23 Jan 2009 23:02:31 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081209)

Hi, I hope you understand my English, I have some problem with the "b" option of sort (Slackware 12.2, kernel 2.6.27.7-smp, Coreutils 6.12).

From the "-k" section of the doc:
a character position of zero in pos2 indicates the field's last
character. If ‘.c’ is omitted from pos1, it defaults to 1 (the beginning
of the field); if omitted from pos2, it defaults to 0 (the end of the
field).

reading this I'd expect #1 and #2 to have the same effect, since I didn't read about any special cases.

From the examples section:
The inheritance works in this case because -k 5b,5b and -k 5b,5 are
equivalent, as the location of a field-end lacking a ‘.c’ character
position is not affected by whether initial blanks are skipped.

But #1 and #3 also differ:

$ sort -k 1b,1b       #1
a   x
a  y
a z
^D
a z
a  y
a   x

$ sort -k 1b,1.0b     #2
a   x
a  y
a z
^D
a   x
a  y
a z

$ sort -k 1b,1        #3
a   x
a  y
a z
^D
a   x
a  y
a z

$ sort -uk 1b,1b      #1u
a   x
a  y
a z
^D
a z
a  y
a   x

$ sort -uk 1b,1.0b    #2u
a   x
a  y
a z
^D
a   x

$ sort -uk 1b,1       #3u
a   x
a  y
a z
^D
a   x

--
Thanks
 DC




reply via email to

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