|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Total time taken
Hi Friend, Need your help. I have a file which has information of start time and End time . I need to find how much time takes to complete the job . how can I do it in unix command . Example of Log file : Code:
Start Loading ---Thu Aug 2 17:14:09 EDT 2012 Load completed successfully---Fri Aug 3 09:00:44 EDT 2012
Last edited by Corona688; 08-03-2012 at 12:48 PM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
This may be simple on some systems and extremely difficult in others. What's your OS and shell?
uname -a if you don't know. If you have Linux, converting dates into timestamps is straightforward: Code:
$ date +%s -d "Thu Aug 2 17:14:09 EDT 2012" 1343942049 $ ...and getting the difference between two times becomes a matter of simple arithmetic. Last edited by Corona688; 08-03-2012 at 12:54 PM.. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
OS is AIX .
|
|
#4
|
|||
|
|||
|
We changed the code and put the following logic Code:
START=$SECONDS END=$SECONDS echo elapsed time is $((END-START)) seconds Can any one help how to convert this seconds in HH MM SS format |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
That comes down to math. Code:
SS=$(( (END-START) % 60 )) MM=$(( ((END-START) / 60) % 60 )) HH=$(( ((END-START)/(60*60))%24 )) |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Not sure but does AIX have the 'time' command? If so, preface your command with the time command Code:
time <your command> This will provide the system time, the user time and the total time. |
| Sponsored Links | ||
|
![]() |
| Tags |
| total time taken |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Total Time | j_panky | Shell Programming and Scripting | 21 | 06-01-2011 06:59 AM |
| How to get total time using awk | ashimada | Shell Programming and Scripting | 8 | 07-22-2010 10:47 PM |
| Calculate total space, total used space and total free space in filesystem names matching keyword | bigben1220 | Shell Programming and Scripting | 4 | 11-25-2009 10:37 AM |
| grep running total/ final total across multiple files | MrAd | UNIX for Dummies Questions & Answers | 5 | 05-08-2007 01:03 PM |
|
|