Hello Daiki,

On 06/10/2015 05:04 PM, Daiki Ueno wrote:
Hello,

I occasionally have to deal with sequential numbers which is largely
contiguous, but contain gaps (e.g., Unicode code points).

<...>

   $ { seq 1 10; seq 12 22; seq 26 34; } | uniq --sequential
   1
   12
   26

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

-assaf

Reply via email to