BASH scripting sorting by date

bash, date, sorting

Solution

try

sort  -t '|' -k 3.8,3.11nr  -k 3.4,3.6Mr -k 3.1,3.2nr < input
      ------ -------------  ------------ ------------
      sep    first key      second key   third key

Problem

I'm new to scripting in bash and our professor had us sort a file in this format ``` peas|10.00|05 Apr 2012 pea soup|10.00|05 Jan 2012 ham|10.00|06 Apr 2012 ``` using the date on the third field, with the most recent item appearing on top. I've tried using combinations of filters and sort but they didn't work. Can anyone help me? thanks

Original source