I have a file with next format2011-12-01 user1 access12011-12-01 user1 access22011-12-01 user2 access22011-12-01 user4 access22011-12-02 user1 access12012-01-01 user3 access12012-01-01 user4 access2I would like to have an output that for every user shows the last date, so2011-12-02 user1 access12011-12-01 user1 access22011-12-01 user2 access22012-01-01 user3 access12012-01-01 user4 access2I tried something like this:less myfile.txt | sort -k1r | uniq -f 1  | sort -b -k1but it isn't seems to work right.Thank you for help!
Get lines with maximum values in the column using awk, uniq and sort
shell script;awk;sort;uniq
I think you wantcat myfile.txt| sort -k1 -r | sort --unique --stable -k2,3(see my comment regarding cat above). The first sort will put the newest dates to the top. The second sort will sort by user+access, but, by giving --stable, will keep the previous order of lines that have the same user+access combination, i.e. newest still on top. Giving --unique, only the first line of a run with equal user+access combination is shown. (You can replace it with | uniq -f1, I'd think, if it happens to be a GNU extension your sort doesn't have.)