script to convert epoch into human-readable

This is what I have to start out with

more file
1208217600
1208131200
1193806800

I want to convert the epoch column into a human-readable format. My file has hundreds of these epoch times that I want to loop through and convert. (The epoch time is really the last column of the line)

This is what I am trying

cat file |while read EPOCH
do
READABLE=`gawk 'BEGIN{print strftime("%c", $EPOCH )}'` # not working
READABLE=`gawk 'BEGIN{print strftime("%c",1144172897)}'` # works
echo $READABLE
done

why does the second line work when I hard code the epoch time in?
and the first line where I am reading in the variable not work?

reading about the syntax of the strftime
strftime([format [,timestamp]])

evidently timestamp has to be a number and not a variable

any ideas?

I don't have perl on this box but I do have nawk and awk and sed

Thanks
David

Why use a loop when gawk can do the whole thing w/o the loop.

READABLE=$(gawk '{print strftime("%c", $0)}')
echo $READABLE

ksh93 can do the conversion from epoch seconds to whatever time format you want. for example

#!/usr/bin/ksh93

while read EPOCH
do
   printf "%T\n" '#'${EPOCH}
done < file

will output

Mon Apr 14 20:00:00 EDT 2008
Sun Apr 13 20:00:00 EDT 2008
Wed Oct 31 00:00:00 EST 2007

THat did the trick.

Thanks go to the 2 posters