I have text file that containing two columns and im trying to write a linux code to filter data. The data has "pass" & "fail" status. I need to Show all "pass" lines , when previous line is "fail" and both lines should be within the 30 second of time. pls help me to do this job. thank you. below shows my text file
12/3/2017 13:25:16 AM fail
12/3/2017 13:25:35 AM pass
12/3/2017 14:55:11 AM pass
12/5/2017 23:46:31 AM pass
12/7/2017 13:15:35 AM pass
12/7/2017 19:25:51 AM pass
12/1/2017 15:39:09 AM fail
12/1/2017 15:39:20 AM pass
12/9/2017 21:25:45 AM pass
12/5/2017 16:25:51 AM pass
my required result
12/3/2017 13:25:35 AM pass
12/1/2017 15:39:20 AM pass
Extended GNU
awk
solution:The output:
function get_time(d_str){ ... }
- returns timestamp converted fromd_str
(datetime string)