Em caso de dúvida, use --debug
flag:
xb@dnxb:/tmp$ sort -k 4,4 -k 1,1M -nk 2 test3.txt --debug
sort: using ‘en_SG.UTF-8’ sorting rules
sort: key 3 is numeric and spans multiple fields
Oct 9 12:00:00 [email protected] deferred
^ no match for key
___
_
_________________________________________
Oct 9 13:00:00 [email protected] deferred
^ no match for key
___
_
_________________________________________
Oct 9 14:00:00 [email protected] bounced
^ no match for key
___
_
________________________________________
Isso deve funcionar:
xb@dnxb:/tmp$ sort -b -k4,4 -k1M -k2n -k3n test3.txt --debug
sort: using ‘en_SG.UTF-8’ sorting rules
sort: key 3 is numeric and spans multiple fields
sort: key 4 is numeric and spans multiple fields
Oct 10 12:00:00 [email protected] deferred
________________
___
__
__
_________________________________________
Oct 10 13:00:00 [email protected] deferred
________________
___
__
__
_________________________________________
...
xb@dnxb:/tmp$ sort -b -k4,4 -k1M -k2n -k3n test3.txt
Oct 10 12:00:00 [email protected] deferred
Oct 10 13:00:00 [email protected] deferred
Oct 10 14:00:00 [email protected] bounced
Oct 10 12:30:00 [email protected] deferred
Oct 10 13:30:00 [email protected] deferred
Oct 10 14:30:00 [email protected] bounced
Oct 9 12:00:00 [email protected] deferred
Oct 9 13:00:00 [email protected] deferred
Oct 9 14:00:00 [email protected] bounced
xb@dnxb:/tmp$
Seu -nk 2
está errado, como info sort
declarou:
A position in a sort field specified with ‘-k’ may have any of the
option letters ‘MbdfghinRrV’ appended to it, in which case no global
ordering options are inherited by that particular field.
Assim, letras de opções n
devem ser adicionadas a k
e sua posição . A ordem é importante.