Convert From Month Number to Month Name

Hi,

I have a script that accepts an input date from the user in yyyy-mm-dd format.

I need to get the mm-dd part and convert it to month name.

example:

2011-11-15

I want that to become "Nov 15"

I don't have the GNU date, I am using an AIX os.

Thanks.

An example:

dat="2011-11-15"

echo $dat | 
awk -F- '{
  split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", month, " ")
  print month[$2] OFS $3
}'
1 Like