I am parsing with awk an output file where in certain point the date is displayed in this way
08/20/2014--05:08:48 PM--357624188
...
08/20/2014--05:10:04 PM--487503599
...
I would like to know whether is possible or not to convert the string date/time into a integer because I would like to calculate the MTBF based on that time.
May anyone tell me how to achieve that casting in awk/gawk?
Thanks in advance,
Best regards!
Edit: My output should be 357624188 as an integer so that I can suctract 487503599 - 357624188
SOLVED: as @Kent was suggesting, I could solve it using
awk 'BEGIN {previousT=0}{print $NF " " previousT " " $NF - previousT; previousT=$NF;}'
357624188but I would like it to be a integerawk -F'--' '{print $NF}' file? :-),instead of a hard-coded" "between output fields. e.g.awk 'prev!=""{print $NF, prev, $NF-prev} {prev=$NF}'.