0

INPUT:

b|2013.06.03. 18:47|
a|2013.06.03. 13:15|
c|2013.06.03. 13:53|

needed OUTPUT:

a|2013.06.03. 13:15|
c|2013.06.03. 13:53|
b|2013.06.03. 18:47|

How can I sort the dates correctly in ascendant order? The delimiter is the |.

P.S.

sort -t "|" -n -k 2

is not enough, because it doesn't put the HH:MM in good order, only the YYYY.MM.DD.

3

Try:

sort -t "|"  -k 2

By leaving out the -n, you sort on the whole string between '|' characters not just the first number that can be made out of that string (2013).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.