I have a tab separated file and the date columns contains date with two different formats. I am using this sort command to sort by one format type ("%a %b %d %H:%M:%S %Z %Y"), but is there any way to sort by the date column regardless of it is format? Thanks!
Input
date
Mon Mar 02 03:56:26 UTC 2020
2020-03-03 15:46:52
sort -t$'\t' -k 3.25,3.28n -k 3.5,3.7M -k 3.9,3.10n -k 3.12,3.13n -k 3.15,3.16n -k3.18,3.19n sample.csv
YYYY-MM-DD HH:MM:SS
and sort lexicographically (sort -k3,3
).