I have an issue with unix sorting command.Problem is
A file contains many records.I need to get a list of all the unique records(unique is on the basis of one key).If the original file contains multiple records with same key ,the last record should be picked(the record which has the highest line number).
I tried with many commands but nothing works
like if the file name is hello
1. sort -un  -t ';' +4n hello
2. tail -r hello | sort -un  -t ';' +4n
3. sort -unr  -t ';' +4n hello
4.tail -r hello | sort -urn  -t ';' +4n
What is does is it picks up random record from the list of records of same key but i want is the last record.
I want to know on what basis unix picks the record? Is it the highest checksum of record or other values ?