[Solved] Return not so similar codes from a single group [closed]


I would harness GNU AWK for this task following way, let file.txt content be

9003103
9003103

9003978
9003979

9003763
9003728

9003543
9003543
9003543

then

awk 'BEGIN{RS=""}{diff=$NF-$1;diff=diff>0?diff:-diff}diff>NF' file.txt

gives output

9003763
9003728

Explanation: I set RS to empty string to provoke paragraph mode, thus every block is treated as single line, then for each block I compute absolute of difference between first and last field, if difference is bigger than number of field block is printed.

(tested in GNU Awk 5.0.1)

1

solved Return not so similar codes from a single group [closed]