Dado este arquivo:
cat file
lat,lon,fhr
33.90000,-76.50000,0
34.20000,-77.00000,6
34.20000,-77.50000,12
então
awk -F, '
function interpolate(lat1, lon1, t1, lat2, lon2, t2, i) {
for (i = 1; i <= (t2 - t1); i++) {
printf "%.5f,%.5f,%d\n",
lat1 + i * (lat2 - lat1) / (t2 - t1),
lon1 + i * (lon2 - lon1) / (t2 - t1),
t1 + i
}
}
NR <= 2 {print}
NR >= 3 {interpolate(lat, lon, t, $1, $2, $3)}
{lat = $1; lon = $2; t = $3}
' file
lat,lon,fhr
33.90000,-76.50000,0
33.95000,-76.58333,1
34.00000,-76.66667,2
34.05000,-76.75000,3
34.10000,-76.83333,4
34.15000,-76.91667,5
34.20000,-77.00000,6
34.20000,-77.08333,7
34.20000,-77.16667,8
34.20000,-77.25000,9
34.20000,-77.33333,10
34.20000,-77.41667,11
34.20000,-77.50000,12