I am having file containing following lines
abcd15051969vignesh
efgh16071989ganesh
ijkl18091972murugesh
mnop15051969santhosh
qrst21061967mahesh
uvwx16071989suresh
now I want to sort the lines on the basis of date of birth and remove the duplicate lines containing same date of birth
You can tell sort
to sort by date and to return unique values:
sort -u -k1.9,1.12 -k1.7,1.8 -k1.5,1.6 < input
^ ^
| |
unique start the sort
key at 1st word,
from char 7 to 8
qrst21061967mahesh
abcd15051969vignesh
ijkl18091972murugesh
efgh16071989ganesh
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.