uniq based on fields 1-10
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
On 2008-01-19, Peter <petercritic [at] yahoo.com> 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
Just tried it and works great :)
Thanks,
Pete