Tengo la siguiente lista de archivos ordenados según Excel:
a1.txt
a10.txt
a11.txt
a12.txt
a2.txt
Si lo uso sort
en Unix/Linux, obtengo el siguiente orden:
a10.txt
a11.txt
a12.txt
a1.txt
a2.txt
donde se puede ver un comportamiento diferente para el personaje .
. ¿Existe alguna opción para obtener el mismo orden que Excel? Intenté -b, -g, -n,... sin éxito.
Respuesta1
env LC_ALL=C sort
De la man
página de sort
:
*** WARNING *** The locale specified by the environment affects sort
order. Set LC_ALL=C to get the traditional sort order that uses native
byte values.
Consulte esta pregunta de StackOverflow para obtener más detalles.
Respuesta2
Pruebe el siguiente comando : sort -d
;)