Formatting output so I can calculate time difference between two stamps
I know there have been a million questions regarding calculating time stamps, and with enough googling, I think I'm almost there (I'm going to use the changing the times into seconds and subtracting solution). My problem is that I'm not sure how to format my log file to get the info I need. Below is the script that's generating the report, bare with me because it's a little big
Basically what the script is doing is going through a log file, getting session ID's, then looking for both the start time and the end time for each session and dumps it into a tmp file. Then it goes through and looks at the tmp file, and looks to see if there is both a start and an end time, and if so, shows the start time, the end time and the session ID. What I'd love to do is calculate the differences between the two times, but I'm not sure how to get there. The script would have to know that each "Setup" and each "Teardown" is a pair, and then work on just that pair. I was thinking maybe I could find a way to put each pair on one line and then do a while read x y timeA a b timeB ... and then compare like that, and then format them back the way I want, but that seems really sloppy, and a lot of overhead. So, does anyone have any ideas? In case it matters, this is what the raw tmp file looks like before I go through in the end and format it:
I have time in a file in HH:MM:SS format as it contents(its not the file creation time). i need this to be converted to epoch time or time since 1970. The time is written into that file by a script, which i cannot modify. Im using AIX machine
$ cat abc.txt
10:29:34 (2 Replies)
Hi Friends,
I have 2 varaibles which contain
START=`date '+ %m/%d/%y %H:%M:%S'`
END=`date '+ %m/%d/%y %H:%M:%S'`
i want the time difference between the two variables in Seconds.
Plz help. (2 Replies)
Hi All,
I am new to shell scripting.I have to write a shell script for the problem statement:
"A file is updated continously. If it is not updated for a day then an error message needs to pop up."
So the script needs to read the last modified time of that file and current system time .If... (4 Replies)
Hello,
I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes...
I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes.
To do... (10 Replies)
hi,
I have a log file which gives time stamps hh:mm:ss.sssss format in which
hh- hours , mm -minutes ss.sssss - seconds.microseconds
I need to calculate the time diff between sent time stamp and received time stamp ....
could any one please help me..
i am tryin to write a script but... (2 Replies)
Hello All,
I have a problem calculating the time difference between start and end timings...!
the timings are given by 24hr format..
Start Date : 08/05/10 12:55
End Date : 08/09/10 06:50
above values are in mm/dd/yy hh:mm format.
Now the thing is, 7th(08/07/10) and... (16 Replies)
Hi All,
I've written a script which reads all the systems backup information and saves it in a log file.
ssh -l ora${sid} ${primaryhost} "tail -1 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" | awk '{print $3,$4,$5,$6}' >> ${RESULTFILE}
The output comes as below:
2008-09-30 06.00.01... (2 Replies)
Hi All,
I've written a script which reads all the systems backup information and saves it in a log file.
ssh -l ora${sid} ${primaryhost} "tail -2 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" |head -1 | awk '{print echo "PREVIOUS:-- Start Date&Time: " $3,$4,echo "|| End Date&Time:... (1 Reply)
Hi,
Please help me in calculating the time difference between below mentioned timestamps.
a=07/17/2007 02:20:00 AM MST
b=07/17/2007 02:07:46 AM MST
Thanks (2 Replies)