Change in the file

Hi,

I have a file which has wrong time format and we want to correct it before we load it.

WRONG FORMAT : 93:0:00
CORRECT FORMAT :09:30:00

If you notice the 0 at the front is missing. Its the case always.

echo "format : 93:0:00" | awk '{c=split($NF,a,":"); for (i=1;i<=c;i++) s=s sprintf(":%02d", a); $NF=substr(s,2)} {print};'

It changed it to 93:00:00. i want it to be 09:30:00

echo "format : 93:0:00" | awk '{gsub(":","",$NF); $NF=sprintf("%06d", $NF); for (i=1;i<=5;i+=2) s=s ":" substr($NF,i,2); $NF=substr(s,2)} {print};'

It gave me a syntax error

Can you post the exact message?

--edit--
Try:

sed 's/\([0-9]\)\([0-9]\):\([0-9]:[0-9][0-9]\)/0\1:\2\3/g' file

--
On Solaris use /usr/xpg4/bin/awk rather than awk

Thanks, Worked fine.