I have a list of dates and times that I would like to convert to seconds since the epoch and these are stored in a file. I've written a shell script to do this and also generated some test data (because the actual file I want to run this on is quite large). My test data looks like this:
Thu Mar 30 2006 11:53:03
Fri Mar 31 2006 12:54:01
My shell script is the following:
while read line
seconds=`date -d "$line" +%s`
echo $seconds >> seconds
When I view the "seconds" file, there's only one line in it, so I'm assuming that the loop only executes once for some reason. I can't figure out what I'm doing wrong though.