Sponsored Content
Full Discussion: Find time difference
Top Forums UNIX for Dummies Questions & Answers Find time difference Post 302662923 by wnaguib on Wednesday 27th of June 2012 10:25:23 AM
Old 06-27-2012
Dears,

Thanks alot for all your comments ,let me clarify some issues.

1-When i first posted my question i posted in shell-programming and scripting, just after i found that it's position in such forum is misleading so i re posted it this forum

2-I am a newbie in this forum and this is the first script i write . so thanks for your patience and cooperation.

3-I am sure that all of your assistance is very valuable ,i do not intend to waste any of your time .

4-I have tried many things and recently read a lot of useful stuff in FAQ .

Here is what ive upto :

a-I succeeded to remove the ".oz" in the last of 2 dates

I found the below script which transfers the YYMMDD to YY month(MM)-DD

Code:
echo "20110614" | nawk 'BEGIN{split("JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC",month," ")}
{printf("%s-%s-%s\n",substr($0,7,2),month[substr($0,5,2)+0],substr($0,1,4))}'

b- sadly its not YYYYMMDDHHMMSS ,even if so i cant get to subtract 2 times.

c- I read something about unix time . if i managed to modify such time into unix time will i be able to find the difference easly ?

Thanks alot for your cooperation in advance.



Moderator's Comments:
Mod Comment Please view this code tag video for how to use code tags when posting code and data.

Last edited by vbe; 06-27-2012 at 11:32 AM.. Reason: code tags
 

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. 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

4. Shell Programming and Scripting

Find Time difference in Unix

Hi, START_TIME :- "10-NOV-2009 00:00:04" STOP_TIME :- "10-NOV-2009 00:05:47" Please help to find difference between these two. Searched for the same topic but did not find an answer for the same time format :( Regards, Robin (3 Replies)
Discussion started by: robinbannis
3 Replies

5. 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

6. 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

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. 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

9. Shell Programming and Scripting

awk script to find time difference between HTTP PUT and HTTP DELETE requests in access.log

Hi, I'm trying to write a script to determine the time gap between HTTP PUT and HTTP DELETE requests in the HTTP Servers access log. Normally client will do HTTP PUT to push content e.g. file_1.txt and 21 seconds later it will do HTTP DELETE, but sometimes the time varies causing some issues... (3 Replies)
Discussion started by: Juha
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
CHRONICLE(1)						User Contributed Perl Documentation					      CHRONICLE(1)

NAME
chronicle - A simple blog compiler. SYNOPSIS
chronicle [options] Path Options: --comments Specify the path to the optional comments directory. --config Specify a configuration file to read. --input Specify the input directory to use. --output Specify the directory to write output to. --theme-dir Specify the path to the theme templates. --theme Specify the theme to use. --pattern Specify the pattern of files to work with. --url-prefix Specify the prefix to the live blog. --sitemap-prefix Specify the prefix for the site map. Blog Entry Options: --format Specify the format of your entries, HTML/textile/markdown. Pre & Post-Build Commands: --pre-build Specify a command to execute prior to building the blog. --post-build Specify a command to execute once the blog has been built. --pre-filter A command to filter each blog entry before HTML conversion. --post-filter A command to filter each blog entry after HTML conversion. Sorting Options: --recent-dates-first Show recent entries first in the archive view. --recent-tags-first Show recent entries first in the tag view. Counting Options: --entry-count=N Number of posts to show on the index. --rss-count=N Number of posts to include on the RSS index feed. Optional Features: --author Specify the author's email address --comment-days Specify the number maximum age of posts to accept comments. --date-archive-path Include the date in the archive. --force Force the copying of static files from the blog theme. --lang Specify the language to use for formatting dates. --lower-case Lower-case all filenames which are output. --no-archive Don't create an archive page. --no-cache Don't use the optional memcached features, even if available. --no-calendar Don't use the optional calendar upon the index. --no-comments Don't allow comments to be posted. --no-sitemap Don't generate a sitemap. --no-tags Don't produce any tag pages. --no-xrefs Don't produce any cross references. Help Options: --help Show the help information for this script. --manual Read the manual for this script. --verbose Show useful debugging information. --version Show the version number and exit. ABOUT
Chronicle is a simple tool to convert a collection of text files, located within a single directory, into a blog consisting of static HTML files. It supports only the bare minimum of features which are required to be useful: * Tagging support. * RSS support. * Archive support. The obvious deficiencies are: * Lack of support for instant commenting. * Lack of pingback/trackback support. Having said that it is a robust, stable, and useful system. BLOG FORMAT
The format of the text files we process is critical to the output pages. Each entry should look something like this: Title: This is the title of the blog post Date: 2nd March 2007 Tags: one, two, three, long tag The text of your entry goes here. NOTE: The header MUST be separated from the body of the entry by at least a single empty line. In this example we can see that the entry itself has been prefaced with a small header. An entry header is contains three optional lines, if these are not present then there are sensible defaults as described below. The formatting of the output dates may be changed via the use of the B<--lang> command line option (or the matching "lang=french" option in the configuration file), but the date of the entry itself should be specified in English. Title: Describes the title of the post. If not present the filename of the entry is used instead. "Subject:" may also be used. Subject: This is a synonym for 'Title:'. Date: The date the post was written. If not present the creation time of the file is used instead. Publish: This header is removed from all entries, and is used by the chronicle-spooler script. Tags: Any tags which should be associated with the entry, separated by commas. The format of the entry is assumed to be HTML, however there is support for writing your entries in both textile and markdown formats. The format of entries is specified via the B<--format> argument, or via a "format: foo" setting in your chroniclerc file. The format of entries is assumed to be global; that is all your entries will be assumed to be in the same format. However you can add a "format: foo" pseudo header to specific entries if you wish to write specific entries in a different format. To allow flexibility in the handling of entries each blog entry will be passed through the filter script B<chronicle-entry-filter> which allows you to modify this handling in a single location. This script allows entries to be updated via filters both before and after the conversion to HTML. For further details please see the manpage for that script. CONFIGURATION
The configuration of the software is minimal, and generally performed via the command line arguments. However it is possible to save settings either in the file global /etc/chroniclerc or the per-user ~/.chroniclerc file. If you wish you may pass the name of another configuration file to the script with the B<--config> flag. This will be read after the previous two files, and may override any settings which are present. The configuration file contains lines like these: input = /home/me/blog output = /var/www/blog format = markdown Keys which are unknown are ignored. OPTIONAL CACHING
To speed the rebuilding of a large blog the compiler may use a local Memcached daemon, if installed and available. To install this, under a Debian GNU/Linux system please run: apt-get update apt-get install memcached libcache-memcached-perl You may disable this caching behaviour with --no-cache, and see the effect with --verbose. OPTIONAL CALENDAR
If the 'HTML::CalendarMonthSimple' module is available each blog will contain a simple month-view of the current month upon the index. To disable this invoke the program with '--no-calendar'. OPTIONAL COMMENTING
Included with the chronicle code you should find the file cgi-bin/comments.cgi. This file is designed to write submitted comments to the local filesystem of your web-server. If you install that, and edit the path at the start of the script you should be able to include comments in your blog. In short there are three things you need to do: Install the CGI script and edit the path at the start. Copy the output comments to your local blog source. Run this script again with --comments=./path/to/comments This should include the comments in the static output. More explicit instructions are provided within the file 'COMMENTS' included within the distribution. AUTHOR
Steve -- http://www.steve.org.uk/ LICENSE
Copyright (c) 2007-2010 by Steve Kemp. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. perl v5.12.3 2011-05-15 CHRONICLE(1)
All times are GMT -4. The time now is 11:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy