1.gui Qxx 16
2.gu Qxy 23
3.guT QWS 18
4.gui Qxr 21
i want to sort a file depending a value in the 3rd column, so i use:
sort -rnk3 myfile
2.gu Qxy 23
4.gui Qxr 21
3.guT QWS 18
1.gui Qxx 16
now i have to output as: (the line starting with 3.gui is out because the line with 4.gui has a greater value)
2.gu Qxy 23
4.gui Qxr 21
1.guT QWS 18
i can not use -head
because i have millions of rows and i do not where to cut, i could not figure a way to use -uniq
because it treats a line as whole and since i can not tell -uniq
to look at first column, it counts a line which has unique it outputs it -which is normal-. i know -uniq
can ignore a number of characters but as you can see from example first column might have various character count..
please advice..