I have a log file consisting of a list of epoch 19-digit timestamps, for example
1603871402884765526
1603871402884859949
1603871402885343431
1603871402885403005
1603871402932368738
1603871402932735285
1603871402932741891
1603871402932785964
1603871402934480339
1603871402934539183
I would like to iterate through this list, and compare the previous timestamp to the current timestamp in the list and echo a message if x duration of inactivity as occurred, ex:
diff=$(( $previoustimestamp - $currenttimestamp ))
if [ $diff -gt 5000000000 ]
then
echo "Inactivity between $previoustimestamp and $currenttimemstap: $diff nanoseconds"
continue
else
continue
fi
What would be the most efficient method to iterate through the list such that the current timestamp becomes the previous time stamp, and so forth, until I reach the end of the list?
Many thanks