This is a file . I want to remove the repetition in the name of patch
[ppande@server-1 —]$egrep 'Patch[0-9].*.*:' content1
Patch1001 : snmp fixl.org
Patch1002 : dhcp tmp fix
Patch1003 : qemu-img-9.0.58
Patch001 : snmp fixl.org
Patch002 : dhcp installation
Patch003 : qemu
Patch004 : snmp fixl.org
I used 'sort -u' but here the order of the patch is changed . All I need is the output with out repetitions and order remains same , or in other words if there is a repetition the second/last occurrence must not be displayed .
[ppande@server-1 —]$egrep 'Patch[0-9].*.*:' content1 | sort -u -k3
Patch002 : dhcp installation
Patch1002 : dhcp tmp fix
Patch003 : qemu
Patch1003 : qemu-img-0.0.58
Patch1001 : snmp fixl.org
Patch001 : snmp fixl.org
Desired output:
Patch1001 : snmp fixl.org
Patch1002 : dhcp tmp fix
Patch1003 : qemu-img-9.0.58
Patch002 : dhcp installation
Patch003 : qemu