The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
crontab every 2 minutes, 24 hours and once a week Bobafart UNIX for Dummies Questions & Answers 6 05-17-2007 10:08 AM
Add data in days:hours:min:sec format krishna_sicsr Shell Programming and Scripting 1 03-17-2007 11:39 AM
Time Difference in seconds k_bijitesh UNIX for Advanced & Expert Users 1 01-16-2007 04:15 AM
how to display time in minutes n seconds... santy Shell Programming and Scripting 1 08-23-2006 10:18 AM
Convert minutes to hours, minutes, seconds Vozx Shell Programming and Scripting 1 12-09-2005 01:24 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 02-20-2008
Sreejith_VK
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Difference in day-hours-minutes-seconds format

Hi experts,

I am reading two log files and passing dates as output to a txt file.
Code is given below:

echo "Start Time:" >> Report.txt
cat start.log | while read LINE1
do
echo $DATE1 >> Report.txt
done
echo "End Time:" >> Report.txt
cat end.log | while read LINE2
do
echo $DATE2 >> Report.txt
done

The out put:
Start Time:
Tue, Feb 19, 2008 08:00:02 PM
End Time:
Wed, Feb 20, 2008 02:19:09 AM

Now I want to print the overall time difference between the first output (ie $LINE1) and second output (ie $LINE2)in day-hours-minutes-seconds format.

I read the FAQs on subtracting dates, but couldnt find a method to subtract two dates in the above format.

Thanks in advance.
Sree
  #2 (permalink)  
Old 02-20-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
you haven't found an answer here ?
  #3 (permalink)  
Old 02-20-2008
Sreejith_VK
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
No

I use HP -UX and date -d doesnt work
  #4 (permalink)  
Old 02-20-2008
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by Sreejith_VK View Post
I use HP -UX and date -d doesnt work
What about datecalc ?
  #5 (permalink)  
Old 02-20-2008
Sreejith_VK
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
hi vino,

Can you please help me in understanding how datecalc can be made usefull for this particular issue(to input date which is of the format day ,month date ,year , hours minutes seconds AM/PM)?
  #6 (permalink)  
Old 02-20-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
Did you manage to copy datecalc script to your machine ?
There is a self explainable documentation in that script.
Just type 'datecalc -help'.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0