Operating System - HP-UX
1833480 Members
2828 Online
110052 Solutions
New Discussion

sorting on a field and then making it uniq

 
SOLVED
Go to solution
Donald C Nelson
Frequent Advisor

sorting on a field and then making it uniq

I have a file as follows:
/dev/rdsk/c8t0d4 :EMC :SYMMETRIX 40031000
/dev/rdsk/c9t8d4 :EMC :SYMMETRIX 40031000

These are mirrored disks. How can I sort on the field to only abstract the primary disk and not the mirrored disks.
3 REPLIES 3
Bill Hassell
Honored Contributor

Re: sorting on a field and then making it uniq

In LVM, the primary and secondary relationship is arbitrary and can be reversed at any time. And because the two line are not the same (the device file is different), you would have to write a script to see if the ID is the same and then skip if true.


Bill Hassell, sysadmin
James R. Ferguson
Acclaimed Contributor
Solution

Re: sorting on a field and then making it uniq

Hi Donald:

If you want the sort based on the fourth space-delimited field, then:

sort -k4 -u

Regards!

...JRF...
Donald C Nelson
Frequent Advisor

Re: sorting on a field and then making it uniq

Thanks James, before you sent me the response I had already type that command.