uniq based on fields 1-10

uniq based on fields 1-10

am 19.01.2008 19:01:20 von Peter

I have the following file that contains lines like

LAND|19160 STEVENS CREEK BLVD|CUPERTINO|CA|22,000| | |BARRY SWENSON|
RICHARD TRUEMPLER|(408) 287-0246|||1000002||||2008-01-15|1030

All these lines are sorted so duplicates will be next to each other.
Is there a way using uniq or something else to compare fields 1-10 and
delete the duplicate lines.

Thanks,
Pete

Re: uniq based on fields 1-10

am 19.01.2008 19:23:00 von Bill Marcum

On 2008-01-19, Peter wrote:
>
>
> I have the following file that contains lines like
>
> LAND|19160 STEVENS CREEK BLVD|CUPERTINO|CA|22,000| | |BARRY SWENSON|
> RICHARD TRUEMPLER|(408) 287-0246|||1000002||||2008-01-15|1030
>
> All these lines are sorted so duplicates will be next to each other.
> Is there a way using uniq or something else to compare fields 1-10 and
> delete the duplicate lines.
>
sort -t\| -k1,10 -u

Re: uniq based on fields 1-10

am 19.01.2008 19:48:45 von Peter

Just tried it and works great :)

Thanks,
Pete