How can I convert a file full of unix time strings to human readable dates?
- by skymook
I am processing a file full of unix time strings. I want to convert them all to human readable.
The file looks like so:
1153335401
1153448586
1153476729
1153494310
1153603662
1153640211
Here is the script:
#! /bin/bash
FILE="test.txt"
cat $FILE | while read line; do
perl -e 'print scalar(gmtime($line)), "\n"'
done
This is not working. The output I get is Thu Jan 1 00:00:00 1970 for every line. I think the line breaks are being picked up and that is why it is not working. Any ideas? I'm using Mac OSX is that makes any difference.