I am trying to sort a file as following which has multiple columns, separated with comma, and one of the column has date with the following format mm/dd/yyyy.
$cat filename
AN1143,45.7,03/05/2012,
H9477,45.3,01/15/2010,
DN1222,45.1,03/05/1800,
J960,26.7,06/02,1990,
Z959,28.2,03/21/2016,
H12421,27.7,06/21/2000
My intention is to sort first based on the first column and then the third column which has the date. I tried the following command:
sort -t"," -k1,1 -k3,9n.3,10n -k3,1n.3,2n -k3,4n.3,5n filename
but I faced this error any help with explanation is appreciated.
sort: stray character in field spec: invalid field specification â3,9n.3,10nâ
-k3,9n.3,10n
looks to have the comma and period (dot, full stop) characters interchanged. – icarus Nov 28 '16 at 16:43