Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find records within certain parameters

Status
Not open for further replies.

vidmo

Technical User
Sep 18, 2006
14
GB
Hi, I am trying to smooth out some data. I have a long file formatted with position and signal strength:

22.38762 55.43485 107.333
22.3878 55.43485 94.0333
22.38797 55.43487 83.1333
22.38875 55.435 86.2666
22.38895 55.435 93.2999

I want to go through each line and find all other records in the same file within 0.001 of the position ($1 and $2), and then print the single position with the results (just $3) printed as subsequent fields:

22.38762 55.43485 107.333 101.3 106.8 204.9
22.3878 55.43485 94.0333 95.02 83.7

hope you can help me with this problem.

thanks
vidmo
 
ok, i think i may have found a long winded way of doing this by producing a file of variables:
var1=12.38762
var2=12.3878
var3=12.38797
var4=12.38875
var5=12.38895
var6=12.38915

however i am having trouble feeding this variable into awk.
command check produces:
echo $var1
12.38762
echo $var2
12.3878

however:
awk 'NR==FNR{print NR, $"var"NR;next}' del.tmp
produces:
1 12.38762 45.43484 107.3331
2 12.3878 45.43485 94.03332

so i can see that NR is progressing but it is printing out the whole line in del.tmp instead of just the outside variable??

help!!!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top