i have an variable mydate=2008Nov07
i want o/p as in variable mymonth=11 (i.e nov comes on 11 number month)
i want some command to do this for any month without using any loop.
plz help me
i have an variable mydate=2008Nov07
i want o/p as in variable mymonth=11 (i.e nov comes on 11 number month)
i want some command to do this for any month without using any loop.
plz help me
Something like this could work:
awk -v mon=$mon 'BEGIN { months="janfebmaraprmayjunjulaugsepoctnovdec";} END { print int(index(months, tolower(mon))/3) + 1 }'