Re: remove line if field one is duplicate



On 2/27/07, Keenan, Greg John (Greg)** CTR **
<gjkeenan@xxxxxxxxxxxxxxxxxx> wrote:
Hi,

I have to combine several Unix password files and remove any duplicate
accounts - putting this into LDAP.

I have the following code that will remove any duplicate whole lines but
I need to remove lines only if the first field of the password file is a
duplicate.

This should work

perl -ne 'print unless $h{(split/:/)[0]}++'
.



Relevant Pages