Skip to content

Instantly share code, notes, and snippets.

@jrelo
Created November 10, 2016 20:53
Show Gist options
  • Save jrelo/467d8e00dbcf65aae672a17f145948cd to your computer and use it in GitHub Desktop.
Save jrelo/467d8e00dbcf65aae672a17f145948cd to your computer and use it in GitHub Desktop.
add times with awk
#!/bin/sh
EPOCH='jan 1 1970'
sum=0
for i in $(cat ${1})
do
echo $i
sum="$(date -u -d "$EPOCH $i" +%s) + $sum"
echo $sum
done
echo -e "(${sum}) / 60 / 60"|bc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment