Unix remove duplicates,sort and display the max count -


3/12/2013 12:00 639 count 3/12/2013 12:06 693 count 3/12/2013 12:12 636 count 3/12/2013 12:18 649 count 3/12/2013 12:24 658 count 3/12/2013 12:30 926 count 3/12/2013 12:36 721 count 3/12/2013 12:42 797 count 3/12/2013 12:48 717 count 3/12/2013 12:00 639 count 3/12/2013 12:06 700 count 3/12/2013 12:12 636 count 3/12/2013 12:18 649 count 3/12/2013 12:24 658 count 3/12/2013 12:30 726 count 3/12/2013 12:36 721 count 3/12/2013 12:42 850 count 3/12/2013 12:48 900 count 3/12/2013 12:00 639 count 3/12/2013 12:06 693 count 3/12/2013 12:12 636 count 3/12/2013 12:18 649 count 3/12/2013 12:24 658 count 3/12/2013 12:30 926 count 3/12/2013 12:36 721 count 3/12/2013 12:42 797 count 3/12/2013 12:48 950 count 

output should below:

3/12/2013 12:00 639 count 3/12/2013 12:12 636 count 3/12/2013 12:18 649 count 3/12/2013 12:24 658 count 3/12/2013 12:30 926 count 3/12/2013 12:36 721 count 3/12/2013 12:06 700 count 3/12/2013 12:30 726 count 3/12/2013 12:42 850 count 3/12/2013 12:48 900 count 

try doing :

sort -u -n -k 3 file.txt 

note

  • -u stands uniq
  • -n stands numerical sort
  • -k 3 stands sort 3rd column

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -