[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: delete lines that contain duplicated column items




On 4/4/07, Cameron Hutchison <usenet@xdna.net> wrote:
Jeff Zhang wrote:

>On 4/3/07, Ron Johnson <ron.l.johnson@cox.net> wrote:
>>
>> On 04/03/07 07:39, Jeff Zhang wrote:
>> [snip]
>> >
>> >
>> > I just care about duplicated ones in column 2, if so, to delete the
>> line.
>>
>> Does it matter which line is deleted?
>>
>no, have a unique column 2 and keep undeleted lines to its original format
>will be ok.

$ sort -u -k2 filename

the file order will be mess-up.
I manager to implement with:
cat -ns file | sort -u -k3 | sort -n -k1 | cut -f 2 > final

It's so simple :)
Thanks for the clue and all the kindly reply!

Reply to: