Awk counter help [message #281567] |
Sun, 18 November 2007 07:23 |
tteklem
Messages: 2 Registered: November 2007
|
Junior Member |
|
|
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 my 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 appreciate any tips!
|
|
|
|
|
|