coreutils
[Top][All Lists]
Advanced

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

Re: RFE: uniq --sequential


From: Daiki Ueno
Subject: Re: RFE: uniq --sequential
Date: Thu, 11 Jun 2015 10:10:03 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Assaf Gordon <address@hidden> writes:

> Perhaps the following will suffice?
>
>     $ { seq 1 10; seq 12 22; seq 26 34; } | awk 'A&&(A+1)!=$1 {print} 1 
> {A=$1}'
>     12
>     26
>
> Or, if you want to print the first value as well:
>
>     $ { seq 1 10; seq 12 22; seq 26 34; } | awk 'NR==1{print}
> A&&(A+1)!=$1{print} 1{A=$1}'
>     1
>     12
>     26

Nice tips, thanks!  However, the awk expressions look a bit non-trivial
to me (it partly re-implements the uniq's loop), and I miss other uniq
options (--group and --count) which can be used together.

Regards,
-- 
Daiki Ueno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]