I have a list of coordinates with fixed Lon and vary Lat like this:
75.5 36.5 37.4290504456
75.5 36.4 52.4753456116
75.5 36.3 66.4775466919
75.5 36.2 84.0023193359
75.5 36.1 111.997085571
75.5 36 172.343933105
75.5 35.9 111.806427002
75.5 35.8 83.5655899048
75.5 35.7 65.6402206421
75.5 35.6 50.8337936401
75.5 35.5 33.7828178406
But I would like to remove all rows where lat are integer or a number with 0.5 to have something like this:
75.5 36.4 52.4753456116
75.5 36.3 66.4775466919
75.5 36.2 84.0023193359
75.5 36.1 111.997085571
75.5 35.9 111.806427002
75.5 35.8 83.5655899048
75.5 35.7 65.6402206421
75.5 35.6 50.8337936401
(I removed 36.5, 36 and 35.5)
How can I do this using awk?
>Solution :
Since it’s integers or .5s (special case), you can use $2 modulo 0.5:
$ awk '$2%0.5' file
75.5 36.4 52.4753456116
75.5 36.3 66.4775466919
75.5 36.2 84.0023193359
75.5 36.1 111.997085571
75.5 35.9 111.806427002
75.5 35.8 83.5655899048
75.5 35.7 65.6402206421
75.5 35.6 50.8337936401