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
Peter [ Sa, 19 Januar 2008 19:01 ] [ ID #1911842 ]

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
Bill Marcum [ Sa, 19 Januar 2008 19:23 ] [ ID #1911843 ]

Re: uniq based on fields 1-10

Just tried it and works great :)

Thanks,
Pete
Peter [ Sa, 19 Januar 2008 19:48 ] [ ID #1911845 ]
Linux » comp.unix.shell » uniq based on fields 1-10

Vorheriges Thema: awk doubt
Nächstes Thema: Can wget preserve perms or is there a umask on my face?