awk help
I have a large annual data with a time stamps that increment by 0.002 minutes (ie 1.002 ...365.998 ). Some data is missing in the data and the time stamp is not regularly spaced (e.g 1.002, 1.006 skipping 1.004). the desired output is 1st generate artificial data in column 1 as a time stamp 1.00 to 365.998 regularly spaced with a step of 0.002. Then sort my data to this column puting the data stamp but leaving the values empty when data is missing so that my time series data is equally spaced with empty lines when data point is missing. I have the following awk code to do the job but this will only count by 1.
awk '{a[$1]=$0}END{for(i=1;i<=366;++i) print ((i in a)?a[i]:i)}' /path/to/input I am not sure how to make it count by 0.002 instead. I am new to awk and appreciate any tips! Thanks |
Hi,
And welcome to LQ! Does this help? Code:
i=1 Cheers, Tink |
Thanks Tink that seem to be working
tteklem |
Sweet :}
It's a bit of a kludge, but awks for loop has no notion of a step. It may run faster if you evaluate the quotient once, assign it to a variable and then use that... only just noticed how ugly my hack was :D Code:
i=1 Cheers, Tink |
All times are GMT -5. The time now is 11:08 PM. |