Sponsored Content
Top Forums Shell Programming and Scripting How to calculate the time difference... Post 302242066 by suri.tyson on Wednesday 1st of October 2008 05:47:37 AM
Old 10-01-2008
How to calculate the time difference...

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: "$5,$6,echo "|| RETURN CODE = "$7}' >> ${RESULTFILE}
ssh -l ora${sid} ${primaryhost} "tail -1 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" | awk '{print echo "CURRENT :-- Start Date&Time: " $3,$4,echo "|| End Date&Time: "$5,$6,echo "|| RETURN CODE = "$7}' >> ${RESULTFILE}

The output shows as below:

PREVIOUS:-- Start Date&Time: 2008-09-30 06.00.01 || End Date&Time: 2008-09-30 06.00.49 || RETURN CODE = 5
CURRENT :-- Start Date&Time: 2008-10-01 06.00.06 || End Date&Time: 2008-10-01 09.31.29 || RETURN CODE = 0

Now i want to calculate the time taken from start to End and display it in the last..

$3$4-$5$6 = how much time taken should display hours:minutes

PREVIOUS:-- Start Date&Time: 2008-09-30 06.00.01 || End Date&Time: 2008-09-30 06.00.49 || RETURN CODE = 5 (HR:MM)
CURRENT :-- Start Date&Time: 2008-10-01 06.00.06 || End Date&Time: 2008-10-01 09.31.29 || RETURN CODE = 0 (HR:MM)

How do we do this..??????????????????


Any help is appreciated..

Thank you in advacne..


 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to calculate this time difference

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)
Discussion started by: Prat007
2 Replies

2. Shell Programming and Scripting

How to calculate the time difference.

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)
Discussion started by: suri.tyson
2 Replies

3. Shell Programming and Scripting

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... (0 Replies)
Discussion started by: DeCoTwc
0 Replies

4. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

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)
Discussion started by: smarty86
16 Replies

5. Shell Programming and Scripting

Calculate the Time stamp difference

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)
Discussion started by: firestar
2 Replies

6. Shell Programming and Scripting

Calculate age of a file | calculate time difference

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)
Discussion started by: worm
10 Replies

7. Shell Programming and Scripting

Calculate time stamp difference

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)
Discussion started by: bharath.phatak
4 Replies

8. Shell Programming and Scripting

Calculate time difference between pst and pdt dates in perl

Hi, how to calculate the time difference between PST date and PDT date in perl scripting. date1: Mon Dec 31 16:00:01 PST 2015 date2: Tue Mar 19 06:09:30 PDT 2013 and also difference between PST-PST and PDT-PDT need difference in months or days (months prefereble). (3 Replies)
Discussion started by: praveen265
3 Replies

9. Shell Programming and Scripting

Calculate time difference

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)
Discussion started by: gpk_newbie
2 Replies

10. Shell Programming and Scripting

Calculate time difference between two lines

i grepped the time stamp in a file as given below now i need to calculate time difference file data: 18:29:10 22:15:50 (5 Replies)
Discussion started by: vivekn
5 Replies
uulog(1)						      General Commands Manual							  uulog(1)

NAME
uulog - Displays UUCP log files SYNOPSIS
/usr/lib/uucp/uulog -f system [-number] uulog uulog systems [-number] uulog -s system [-number] uulog -x [systems] The uulog command displays the contents of a log file of uucico or uuxqt activities. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: uulog: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
[Tru64 UNIX] Performs a tail -f on the file transfer log for the specified system, displaying the end of the log file. Use the Interrupt key sequence to leave the file and return to the prompt. Prints information about copy requests involving the specific system. If no sys- tem is specified, information is displayed for all systems. Note: System name can contain only ASCII characters. [Tru64 UNIX] Displays the uuxqt log file for the specified systems. If no systems are specified, information is displayed for all systems. [Tru64 UNIX] Displays the last lines of the log file. The number of lines is determined by the number argument. (To display the lines, the uulog command issues a tail for the specified number of lines.) DESCRIPTION
Individual log files are created for each remote system with which the local system communicates using the uucp, uusend, uuto, or uux com- mands. Use the uulog command to display a summary of uucp, uusend, uuto, and uux command requests by a system or systems. All of these transac- tions are logged in files under the /usr/spool/uucp/.Log/ directory. The files are named daemon_name/system, where the daemon_name direc- tory is named for the daemon involved and the system file is named for the remote system the daemon is contacting. The uucp and uuto commands call the uucico daemon. The uucico activities are logged in the system file in the /usr/spool/uucp/.Log/uucico directory. The uux and uusend commands call the uuxqt daemon. The uuxqt activities are logged in the /usr/spool/uucp/.Log/uuxqt/system file. You can examine these individual log files by issuing the uulog command directly. However, you can also have these temporary log files appended to a primary log file that you can then examine. This is called compacting the log files and is handled by uudemon.cleanu, a shell script in /usr/lib/uucp. NOTES
The uulog utility is marked LEGACY in XCU Issue 5. EXAMPLES
To display the uucico log file for system hera, enter: uulog -s hera [Tru64 UNIX] To display the uuxqt log file, enter: uulog -x [Tru64 UNIX] To display the last forty lines of the file transfer log for system zeus, enter: uulog -f zeus -40 To display the uucico log file for systems pluto and venus, enter: uulog pluto venus [Tru64 UNIX] To display the uuxqt log file for systems pluto and venus, enter: uulog -x pluto venus FILES
Contains log files. Public directory. SEE ALSO
Commands: ct(1), cu(1), tail(1), tip(1), uucico(8), uucleanup(8), uucp(1), uuencode(1), uudecode(1), uuname(1), uupick(1), uusched(8), uusend(1), uustat(1), uuto(1), uux(1) Standards: standards(5) uulog(1)
All times are GMT -4. The time now is 11:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy