sorting problem
Hello.
I'm having a problem with the gnu sort. It boils down to this:
this sort will work fine:
(contents of file ignore_blanks)
a: a:1
a:b:2
b:a :1
b: b:10
b: b: 2
Note the spaces in lines.
When I use the commands
sort -b -t : ignore_blanks -k 1,1 -k 2,2 -k 3,3
and
sort -t : ignore_blanks -k 1,1 -bk 2,2 -bk 3,3
I get the same results (as I expect):
a: a:1
a:b:2
b:a :1
b: b:10
b: b: 2
But when I try a slight variation of files (i called this ignore_blanks2) and commands, things dont work as I expect:
(contents of ignore_blanks2)
a a 1
a b 2
b a 1
b b 10
b b 2
sort -k 1.1,1.1 -bk 1.3,1.4 -bk 1.6,1.7 ignore_blanks2
Result:
a a 1
a b 2
b b 2
b b 10
b a 1
Here, it does not ignore the leading white space in the specified fields. Anyone know a fix for this?
|