Re: sort parameters question: -V and -f

2011-04-07 Thread Assaf Gordon
Eric Blake wrote, On 04/06/2011 06:36 PM:
 On 04/06/2011 04:04 PM, Pádraig Brady wrote:
 On 06/04/11 22:26, Assaf Gordon wrote:
 I'm wondering if this is a bug (where -f is ignored when using version 
 sort):

 The same happens for any ordering option.
 If any is specified for the key, then all global options are ignored.
 This is specified by POSIX and here it's demonstrated on solaris:

 Not only that, but --debug would have told you the same:
 

--debug did tell me that, but I thought it's a bug, not a feature.
I assumed -f is accumulative, not overridden when specifying per-key sort 
order - I should have read the docs more carefully.

Thanks for the quick and detailed response.

-gordon




sort parameters question: -V and -f

2011-04-06 Thread Assaf Gordon
Hello,

I'm wondering if this is a bug (where -f is ignored when using version sort):

=
$ sort --debug -f -k2,2V 
sort: using simple byte comparison
sort: leading blanks are significant in key 1; consider also specifying `b'
sort: option `-f' is ignored
==

My assumption is that using -f as stand alone parameter should have the same 
effect as using it in a specific key (for that key). e.g. the following two 
commands are equivalent:
 sort -f -k1,1
 sort -k1f,1

But the following two commands are not equivalent (because the standalone -f 
is ignored):
 sort -f -k1V,1
 sort -k1Vf,1

Example:
=

## This works
$ printf a\nB\nc\n | sort -k1f,1
a
B
c
$ printf a\nB\nc\n | sort -f -k1,1
a
B
c

## This doesn't work
$ printf a13\nA5\na1\n | sort -k1Vf,1
a1
A5
a13

$ printf a13\nA5\na1\n | sort -f -k1V,1
A5
a1
a13
===

I'm using coreutils 8.10.

-gordon



Re: sort parameters question: -V and -f

2011-04-06 Thread Pádraig Brady
On 06/04/11 22:26, Assaf Gordon wrote:
 Hello,
 
 I'm wondering if this is a bug (where -f is ignored when using version 
 sort):
 
 =
 $ sort --debug -f -k2,2V 
 sort: using simple byte comparison
 sort: leading blanks are significant in key 1; consider also specifying `b'
 sort: option `-f' is ignored

The same happens for any ordering option.
If any is specified for the key, then all global options are ignored.
This is specified by POSIX and here it's demonstrated on solaris:

solaris:~  printf a13\nA5\na1\n | sort -f -k1r,1
a13
a1
A5
solaris:~  printf a13\nA5\na1\n | sort -k1r,1
a13
a1
A5

cheers,
Pádraig.