I have two files (STARTED and COMPLETED) that look like this:
STARTED FILE:
2018-01-30 10:21:41
2018-01-17 12:22:50
2018-06-27 23:09:20
INVALID
INVALID
... for 800 Rows
COMPLETED FILE:
2018-01-30 10:23:54
2018-01-17 13:23:45
2018-06-28 06:10:56
INVALID
INVALID
... for 800 rows
I need to create a third file that has the result of difference of each row for file2 and file1 - to get the time lapse.
NEW 3rd FILE:
00:02:13
01:00:55
07:01:36
INVALID //Where any instance of invalid in either file remain in the new file.
INVALID
... for 800 rows
I was able to get this to work manual using this command but no luck looping through my file:
string1="10:21:41"
string2="10:23:54"
StartDate=$(date -u -d "$string1" +"%s")
FinalDate=$(date -u -d "$string2" +"%s")
date -u -d "0 $FinalDate sec - $StartDate sec" +"%H:%M:%S"
> 00:02:13