I've file with 2 columns
Cla Clb
5301 1922
5301 1923
5301 1925
5311 2020
5311 2021
5311 2022
5321 1880
5321 1885
5321 1886
5321 1887
... ...
I need to find cumul of diffrence values upper than 1 on column b with the same value of column a
if value of Cla is the same ex: 5301 do (1925-1923=2),(1923-1922=1) : cumul difference > 1 is equal 1 so cumul1=1
second value of Cla 5311 do (2022-2021=1), (2021-2020=1) : cumul difference > 1 is 0 so cumul2=0
third value of Cla 5321 (1887-1886=1), (1886-1885=1); (1885-1880=5) cumul difference > 1 is 1 so cumul3=1
at the end I'll calculate cumul1+cumul2+cumul3+...cumuln
using bash script or awk
attached wall file test
thanks for your help
Cla Clb
5301 1922
5301 1923
5301 1925
5311 2020
5311 2021
5311 2022
5321 1880
5321 1885
5321 1886
5321 1887
... ...
I need to find cumul of diffrence values upper than 1 on column b with the same value of column a
if value of Cla is the same ex: 5301 do (1925-1923=2),(1923-1922=1) : cumul difference > 1 is equal 1 so cumul1=1
second value of Cla 5311 do (2022-2021=1), (2021-2020=1) : cumul difference > 1 is 0 so cumul2=0
third value of Cla 5321 (1887-1886=1), (1886-1885=1); (1885-1880=5) cumul difference > 1 is 1 so cumul3=1
at the end I'll calculate cumul1+cumul2+cumul3+...cumuln
using bash script or awk
attached wall file test
thanks for your help