I have multiple files a.csv, b.csv, c.csv. All these files contains rows formatted the same way:
12345798SOMEID24597;ThisisaTest;2021/11/04 17:07:05;SOMETHINGELSE
I would like to merge all these files into a single file with the rows sorted by the date.
CodePudding user response:
sort -t ';' -k 3 *.csv > sorted.csv
Is fine. You don't need -n
(--numeric-sort
), because the numbers are all the same fixed width.
CodePudding user response:
I do it with a cat and a sort currently.
cat *.csv > merged_file.csv
sort --field-separator=';' --key=3 merged_file.csv > merged_sorted_file.csv