For Programmers: Free Programming Magazines  


Home > Archive > AWK > February 2005 > using data in one file to change a $ in a 2nd









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author using data in one file to change a $ in a 2nd
rhnaeco

2005-02-22, 2:33 pm

I have 2 files. one contains bathymetry with one record per second, with the time (in seconds from midnight) as $1. This needs to be tidally corrected with data from the second file which has time in the same format but each record is 300 seconds apart. I need to look at each line on the bathymetry (1st) file and compare the time reading with that of the tidal file (2nd) and if it is within +299 secs of the time in the first, then I need to +or- $2 (2nd file) with the data in $4.

e.g 1st bathy file
time $2 $3 $4 (depth)
34587 12.45362 45.42572 -16.07
34588 12.45361 45.42573 -16.10

e.g 2nd tide file
time depth
34300 1.98
34600 2.05

hopefully i want to end up with the original bathymetry file but with each second of $4 data tidally corrected.
I hope i can do this with awk as i have used it for the other parts of processing, but if not does anyone know of another way?
thanks in advance

R
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com