Sponsored Content
Full Discussion: Find Time difference in Unix
Top Forums Shell Programming and Scripting Find Time difference in Unix Post 302371789 by robinbannis on Monday 16th of November 2009 07:55:12 AM
Old 11-16-2009
Thanks a lot for your replay..

I have two variables

START_TIME="10-NOV-2009 00:00:04"
STOP_TIME="10-NOV-2009 00:05:47"

And now i need the difference in seconds in a third variable.

TIME_DIFFERENCE=$($START_TIME - $STOP_TIME)

so here i need the TIME_DIFFERENCE Smilie

Can u help?

Regards,
Robin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To find the time difference between two lines of the same log file

Hello Friends, I want to write a script for the following: nlscux62:tibprod> grep "2008 Apr 30 01:" SA_EHV_SPEED_SFC_IN_03-SA_EHV_SPEED_SFC_IN_03-2.log | grep -i post | more 2008 Apr 30 01:01:23:928 GMT +2 SAPAdapter.SA_EHV_SPEED_SFC_IN_03-SA_EHV_SPEED_SFC_IN_03-2 Info AER3-000095 IDOC... (2 Replies)
Discussion started by: satyakam
2 Replies

2. Shell Programming and Scripting

Help to find the time difference between the lines

Hi guru's, Am new to shell scripting. I am getting the below o/p from the oracle database, when I fire a query. ID JOB_ID ELAPSED_TIME FROM TO ----- ------ ------------------- -------- -------- 62663 11773 01/06/2009 09:49:13 SA CM 62664 11773 ... (4 Replies)
Discussion started by: sathik
4 Replies

3. Shell Programming and Scripting

Time difference in Minute in UNIX

is there any ways to get the time difference between 2 dates in UNIX? for example, For below date the outut should come 22 minutes startdate enddate ========= ======= 06/17/2008 13:25 06/17/2008 13:47 For, below date, the output should come 1462 minutes ... (5 Replies)
Discussion started by: Amit.Sagpariya
5 Replies

4. AIX

How to find time difference between 2 timestamps?

HI All, can some one please help me how to fine the difference between two time stamps say a= Nov 10, 2009 9:21:25 AM b= Nov 10, 2009 10:21:25 AM I want to find difference between the a & b I googled and tried with some options but no luck. My OS is AIX (1 Reply)
Discussion started by: bandlan9
1 Replies

5. Shell Programming and Scripting

Find time difference between two consecutive lines in same file.

Hello I have a file in following format: IV 08:09:07 NM 08:12:01 IC 08:12:00 MN 08:14:20 NM 08:14:15 I need a script to compare time on each line with previous line and show the inconsecutive line. Ex.: 08:12:00 08:14:15 A better way... (6 Replies)
Discussion started by: vilibit
6 Replies

6. Shell Programming and Scripting

Difference Time Unix Shell

I have 2 variables MTIME="Jan_2_2012_23:55:49" SCH_TIME="Jan_03_2012_00:32:28" I want to find the time taken (in seconds) between MTIME and SCH_TIME. Is there any way by which this can be done in Unix Shell Script? (4 Replies)
Discussion started by: ankitncr
4 Replies

7. Shell Programming and Scripting

How to find time difference?

I have a file wich contains time formats and i need to get the time difference TIME1 TIME2 ================================== 20120624192555.6Z 20120624204006.5Z which means first date 2012/6/24 19:25:55,second date 2012/6/24 20:40:06 so when i get the time... (1 Reply)
Discussion started by: wnaguib
1 Replies

8. UNIX for Dummies Questions & Answers

Find time difference

I have a file wich contains time formats and i need to get the time difference TIME1 TIME2 =============== =================== 20120624192555.6Z 20120624204006.5Z which means first date 2012/6/24 19:25:55,second date 2012/6/24 20:40:06 so when i get the time... (23 Replies)
Discussion started by: wnaguib
23 Replies

9. Shell Programming and Scripting

Find time difference based on logfile

Hi All, Firstly thank you for the forum members I need to find time difference b'w two rows of timestamp using awk/shell. Here is the logfile: cat business_file start:skdjh:22:06:2010:10:30:22 sdfnskjoeirg wregn'wergnoeirnfqoeitgherg end:siifneworigo:22:06:2010:10:45:34... (3 Replies)
Discussion started by: Srinivas Gadi
3 Replies

10. UNIX for Beginners Questions & Answers

In HP-UX how to find the date time difference ?

Hello, In HP-UX how to find the date time difference ? Start time: 28-APR-2019 21:36:01 End time : 29-APR-2019 00:36:04 ---------------------- Difference is ---------------------- Much appreciate any pointer or view on this. ... (3 Replies)
Discussion started by: Siva SQL
3 Replies
Find::Lib(3pm)						User Contributed Perl Documentation					    Find::Lib(3pm)

NAME
Find::Lib - Helper to smartly find libs to use in the filesystem tree VERSION
Version 1.01 SYNOPSIS
#!/usr/bin/perl -w; use strict; ## simple usage use Find::Lib '../mylib'; ## more libraries use Find::Lib '../mylib', 'local-lib'; ## More verbose and backward compatible with Find::Lib < 1.0 use Find::Lib libs => [ 'lib', '../lib', 'devlib' ]; ## resolve some path with minimum typing $dir = Find::Lib->catdir("..", "data"); $path = Find::Lib->catfile("..", "data", "test.yaml"); $base = Find::Lib->base; # or $base = Find::Lib::Base; DESCRIPTION
The purpose of this module is to replace use FindBin; use lib "$FindBin::Bin/../bootstrap/lib"; with something shorter. This is specially useful if your project has a lot of scripts (For instance tests scripts). use Find::Lib '../bootstrap/lib'; The important differences between FindBin and Find::Lib are: o symlinks and '..' If you have symlinks in your path it respects them, so basically you can forget you have symlinks, because Find::Lib will do the natural thing (NOT ignore them), and resolve '..' correctly. FindBin breaks if you do: use lib "$Bin/../lib"; and you currently are in a symlinked directory, because $Bin resolved to the filesystem path (without the symlink) and not the shell path. o convenience it's faster too type, and more intuitive (Exporting $Bin always felt weird to me). DISCUSSION
Installation and availability of this module The usefulness of this module is seriously reduced if Find::Lib is not already in your @INC / $ENV{PERL5LIB} -- Chicken and egg problem. This is the big disavantage of FindBin over Find::Lib: FindBin is distributed with Perl. To mitigate that, you need to be sure of global availability of the module in the system (You could install it via your favorite package managment system for instance). modification of $0 and chdir (BEGIN blocks, other 'use') As soon as Find::Lib is compiled it saves the location of the script and the initial cwd (current working directory), which are the two pieces of information the module relies on to interpret the relative path given by the calling program. If one of cwd, $ENV{PWD} or $0 is changed before Find::Lib has a chance to do its job, then Find::Lib will most probably die, saying "The script cannot be found". I don't know a workaround that. So be sure to load Find::Lib as soon as possible in your script to minimize problems (you are in control!). (some programs alter $0 to customize the display line of the process in the system process-list ("ps" on unix). (Note, see perlvar for explanation of $0) USAGE
import All the work is done in import. So you need to 'use Find::Lib' and pass a list of paths to add to @INC. See "BACKWARD COMPATIBILITY" section for more retails on this topic. The paths given are (should) be relative to the location of the current script. The paths won't be added unless the path actually exists on disk base Returns the detected base (the directory where the script lives in). It's a string, and is the same as $Find::Lib::Base. catfile A shorcut to File::Spec::catfile using Find::Lib's base. catdir A shorcut to File::Spec::catdir using Find::Lib's base. BACKWARD COMPATIBILITY
in versions <1.0 of Find::Lib, the import arguments allowed you to specify a Bootstrap package. This option is now removed breaking backward compatibility. I'm sorry about that, but that was a dumb idea of mine to save more typing. But it saves, like, 3 characters at the expense of readability. So, I'm sure I didn't break anybody, because probabaly no one was relying on a stupid behaviour. However, the multiple libs argument passing is kept intact: you can still use: use Find::Lib libs => [ 'a', 'b', 'c' ]; where "libs" is a reference to a list of path to add to @INC. The short forms implies that the first argument passed to import is not "libs" or "pkgs". An example of usage is given in the SYNOPSIS section. SEE ALSO
FindBin, FindBin::libs, lib, rlib, local::lib http://blog.cyberion.net/2009/10/ive-done-something-bad-i-broke-backward-compatibility.html <http://blog.cyberion.net/2009/10/ive-done-something-bad-i-broke-backward-compatibility.html> AUTHOR
Yann Kerherve, "<yann.kerherve at gmail.com>" BUGS
Please report any bugs or feature requests to "bug-find-lib at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Find-Lib <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Find-Lib>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. ACKNOWLEDGEMENT
Six Apart hackers nourrished the discussion that led to this module creation. Jonathan Steinert (hachi) for doing all the conception of 0.03 shell expansion mode with me. SUPPORT &; CRITICS I welcome feedback about this module, don't hesitate to contact me regarding this module, usage or code. You can find documentation for this module with the perldoc command. perldoc Find::Lib You can also look for information at: o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/Find-Lib <http://annocpan.org/dist/Find-Lib> o CPAN Ratings http://cpanratings.perl.org/d/Find-Lib <http://cpanratings.perl.org/d/Find-Lib> o RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Find-Lib <http://rt.cpan.org/NoAuth/Bugs.html?Find-Lib> o Search CPAN http://search.cpan.org/dist/Find-Lib <http://search.cpan.org/dist/Find-Lib> COPYRIGHT &; LICENSE Copyright 2007, 2009 Yann Kerherve, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-09-17 Find::Lib(3pm)
All times are GMT -4. The time now is 04:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy