I am trying to use awk to manipulate data.I have a data file with two columns and I would like to find the row that contains an specific value. But there is more than one row that contains this value and I only would like to find the first one. I tried it with a for-loop and break but it does not work the way I expected.
{for (i=0;$2==100.0;min=$1){
i++
max=min+500
if(i==1){
print i"\t"min"\t"max
break
}
}
}
After this loop there is a little bit more code which utilizes min and max.
Edit: The data looks like this
59.45 96
59.50 96
59.60 97
59.75 98
59.90 98
59.95 98
60.00 99
60.05 99
60.20 99
60.25 100
60.40 100
60.45 100
60.50 101
60.55 101
60.60 101
60.65 101
60.70 102
60.90 102
60.95 103
61.00 103
61.05 103
61.15 103
61.20 104
61.35 104
61.40 104
61.45 105
61.50 105
61.60 105
61.65 106
61.70 100
61.85 100
I would like to find the first row that contains 100in the second column and save the value from column one in a variable
awk -f test.awk old.dat > new.dat$2==100.0false.