Date Conversion

Hi,

Does anyone know (in KSH, CSH, SED or AWK), how to convert date text in a file from:

EX:
May232008

to:

 05232008

Thanks,

Read the man date for your OS, as a simple example:

# date -j -f "%b%d%Y" "May232008" "+%m%d%Y"
05232008

In pure shell without GNU date:

#!/bin/ksh
convert_date()
{
	dt="$1"	
	choice=0
    case ${dt%%??????} in
    Jan) choice=1;;
    Feb) choice=2;;
    Mar) choice=3;;
    Apr) choice=4;;
    May) choice=5;;
    Jun) choice=6;;
    Jul) choice=7;;
    Aug) choice=8;;
    Sep) choice=9;;
    Oct) choice=10;;
    Nov) choice=11;;
    Dec) choice=12;;
    \*) choice=0;;
    esac
   
    printf "%02d%s" $choice ${dt##???}
}

echo "$(convert_date May052008)"
echo "$(convert_date Dec052008)"
echo "$(convert_date Jan302008)"

Using ksh93

$ printf "%(%m%d%Y)T\n" "May232008"
05232008
$