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

Re: delete lines that contain duplicated column items




On 4/3/07, Joe Hart <j.hart@orange.nl> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff Zhang wrote:
> I have a simple txt file, like:
> ...
> a a
> aa a
> b b
> ba b
> ...
>
> I want to just keep the lines that first appeared in column 2 and delete
> the follow lines that contain duplicated ones in column 2.
> then it will like:
> ...
> a a
> b b
> ...
>
> I've tried `uniq -f1`  but it didn't work.

Question:  Are you asking someone to do your homework for you?

No,  I didn't google out the result so come here to seek some help if possible. And my data file is even more larger.

Question:  Do you mean column 1.  Column 2 doesn't have any duplicate
data in your example.

I just care about duplicated ones in column 2, if so, to delete the line.

Reply to: