Hello everyone,
I have a file which has day of year in one of the columns (JD=substr($0,72,3)). The bellow scripts shows me the minimum and maximum values of the JD and I would like to convert the JD to date.
#!/bin/gawk -f
{
check=substr($0,1,1)
if (check == "S")
{
JD=substr($0,72,3);
{
if(minJD=="")
{
minJD=maxJD=JD
}
if(JD>maxJD)
{
maxJD=JD
}
if(JD< minJD)
{
minJD=JD
}
}
}
}
END {
today = strftime("%d.%m.%Y")
today2 = strftime("%d.%h.%Y")
time=strftime("%H%M")
print minJD, " ",maxJD,today,today2,time
}
Result:
175 197 17.07.2011 17.Jul.2011 0720
Any help is greatly appreciated
What in your result do you want output differently?
I would like to get the date (day.month.year) calculated for JD=175 (24.Jun.2011) and for JD=197 (16.Jul.2011).
Can you give an example from your data file?
Sure, please find attached.
What does lines like these refer to?
S5013 2194 175
S5009 2194 175
S is a code, the next 4 digits represents line, the next 4 are the points (the values of a grid) and the last 3 is the day of the year-JD.
---------- Post updated at 03:53 PM ---------- Previous update was at 03:18 AM ----------
Thanks for your reply, I managed to solve the issue by adding the following code:
mindate=strftime("%d.%m.%Y",systime()-(todayJD-minJD)*(60*60*24))
maxdate=strftime("%d.%m.%Y",systime()-(todayJD-maxJD)*(60*60*24))