I've used several solutions from this forum to delete nonsense and rearrange data in the project file I'm working on. I'm hoping you guys can give me some tips on further rearranging the data (I've seen a few solutions by searching, but one specific item has me stumped, which is only using the date-time fields once).
Each field contains its own separate date/time field (eg 2012071512) but I only need it to strip out the valid times once and then use only the field name (2MTEMP,MSLP,etc) and the value following to line up as given above.
awk '
{
h=$1
getline d
getline v
Date[d]
Header[h]
Value[h,d] = v
}
END {
s="TIME\t"
for (h in Header) {
s = s "\t" h
}
print s
for (d in Date) {
s = d
for (h in Header) {
s = s "\t" Value[h,d]
}
print s
}
}
' infile
Thanks for your help!! I have one question; I noticed when this operated on a longer dataset, it confused some of the date-time groups (for instance, it inserted 2012071618 after 2012071612, while skipping those in between--the last two digits of each group are the UTC hour, by the way) rather than going in chronological order. Is there something I could add to tell it the specific date-time format so it will keep them in order? Thanks again!