just try to implement this logic without using array
and it has to consider first column also that is if next record of column 1 is greater than current record
previous+3 < current < next+3
or
previous-3 > current < next-3
print BAD
being beginner getting many syntax error those who know please help
but with array you may get output as you expected from following code, I assume you might be trying to detect peak values in file, test with your original file and post the same as Jotne suggested
Can you compile a simple C program? This would be easy to write in C, if you can spell out exactly what you want to do. (And if that does not break the forum rules :D)
It would be interesting to compare the performance of some C program vs some awk solution.