This is probably dead simple, but I can't get it to work. How do I correct this sort
notation
sort +0 -1 something
to use more POSIX-compliant -k
notation? If I try sort -k 0,1 something
, sort
just tells me
sort: field number is zero: invalid field specification `0,1'
I can't find it in sort 开发者_运维知识库documentation anywhere.
Try this?
sort -k1,2 something
I don't have a unix-like system on hand that allows the +0 and -1 notation, but my guess is you're looking to sort on maybe the first and second fields? The indices used in the -k flag are one-based, not zero-based, so I think you have the right idea and just need to change your 0,1 to a 1,2.
It was actually simple - I do not need the 0-th field in -k
notation. So, to +0 -1
, -k 1
is an equivalent.
精彩评论