Sponsored Content
Full Discussion: Timestamp comparison
Top Forums Shell Programming and Scripting Timestamp comparison Post 302160130 by zainravi on Monday 21st of January 2008 01:02:02 AM
Old 01-21-2008
Timestamp comparison

Hi all, below is my sample log file

02.20.38 .CASH_I_0069 RPM_RUN_DISTRIBUTION RPM_RUN_DISTRIBUTION 0001 1987 Started at 02.19.11 at node IEREDS17, Pid = 00492972
02.50.39 .CASH_I_0054 RPM_RUN_DISTRIBUTION RPM_RUN_DISTRIBUTION 0001 1987 Completed at 02.49.13, code: 00000000 at node IEREDS17, Pid = 00492972
01.50.34 .CASH_I_0069 RPM_RUN_DISTRIBUTION RPM_RUN_DISTRIBUTION 0001 1986 Started at 01.49.07 at node IEREDS17, Pid = 00492970
02.20.36 .CASH_I_0054 RPM_RUN_DISTRIBUTION RPM_RUN_DISTRIBUTION 0001 1986 Completed at 02.19.09, code: 00000000 at node IEREDS17, Pid = 00492970

as you can see from above the 1st column is the time stamp in hh.mm.ss format (Start time and end time). I am required to create a script:

which finds out the difference between the two and reports the Start time(s) and End time(s) wherever the difference exceeds 15 minutes.

I have tried using the below mentioned script but am not able to advance further. (am stuck with what logic to be used)

#! /usr/bin/awk -f

$7 ~ /Started/ {
m=split($1,st_split,".")}

$7 ~ /Completed/ {
n=split($1,et_split,".")}



PS: my log file contains around 40 lines.

hope this problem is cleaer. please help. thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Timestamp comparison of 2 files present in 2 different servers

Hi, I have 2 different log servers and logs are stored in both of them at varied times. Those servers have same files stored at different times. I want to retrieve the latest of the log files that are stored inthe servers. Say "file.log" is present on both servers, i want to check which of it is... (3 Replies)
Discussion started by: goutham4u
3 Replies

2. UNIX for Dummies Questions & Answers

Timestamp comparison

How do I compare 2 timestamps (ie... if 2008-02-13 10:48:58.502075 gt 2008-12-15 16:00:00.000000) (4 Replies)
Discussion started by: auzark
4 Replies

3. Shell Programming and Scripting

Comparison of a timestamp and mtime of a file

Hi, I am a beginner in shell scripting. Could any one help me out for below requirement. Its bit urgent. Problem scenario: 1) I have a predefined timestamp (Ex. 2011-03-010 10:10:20) 2) And I have files in a directory starting with 'a' (Ex. a_123.txt, a_124.txt) Expected solution: I... (1 Reply)
Discussion started by: itzsamz
1 Replies

4. Shell Programming and Scripting

Getting a relative timestamp from timestamp stored in a file

Hi, I've a file in the following format 1999-APR-8 17:31:06 1500 3 45 1999-APR-8 17:31:15 1500 3 45 1999-APR-8 17:31:25 1500 3 45 1999-APR-8 17:31:30 1500 3 45 1999-APR-8 17:31:55 1500 3 45 1999-APR-8 17:32:06 1500 3 ... (1 Reply)
Discussion started by: vaibhavkorde
1 Replies

5. UNIX for Dummies Questions & Answers

How to compare a file by its timestamp and store in a different location whenever timestamp changes?

Hi All, I am new to unix programming. I am trying for a requirement and the requirement goes like this..... I have a test folder. Which tracks log files. After certain time, the log file is getting overwritten by another file (randomly as the time interval is not periodic). I need to preserve... (2 Replies)
Discussion started by: mailsara
2 Replies

6. Shell Programming and Scripting

Identifying files with a timestamp greater than a given timestamp

I need to be able to identify files with file timestamps greater than a given timestamp. I am using the following solution, although it appears to compare files at the "seconds" granularity and I need it at the milliseconds. When I tested my solution, it missed files that had timestamps... (3 Replies)
Discussion started by: nkm0brm
3 Replies

7. Shell Programming and Scripting

Comparison of timestamp on ftp

Hello Need help with shell script There is are files on my ftp. They overwriting every hour from other places. ls -la /home/ftp/ -rw-r--r-- 1 ftp nogroup 2296 2012-08-11 12:59 G1.zip -rw-r--r-- 1 ftp nogroup 6676 2012-08-11 13:00 KRT1.zip -rw-r--r-- 1 ftp nogroup 5169... (3 Replies)
Discussion started by: ck80
3 Replies

8. Shell Programming and Scripting

To check timestamp in logfile and display lines upto 3 hours before current timestamp

Hi Friends, I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies

9. Shell Programming and Scripting

AIX : Need to convert UNIX Timestamp to normal timestamp

Hello , I am working on AIX. I have to convert Unix timestamp to normal timestamp. Below is the file. The Unix timestamp will always be preceded by EFFECTIVE_TIME as first field as shown and there could be multiple EFFECTIVE_TIME in the file : 3.txt Contents of... (6 Replies)
Discussion started by: rahul2662
6 Replies

10. Shell Programming and Scripting

Grep lines between last hour timestamp and current timestamp

So basically I have a log file and each line in this log file starts with a timestamp: MON DD HH:MM:SS SEP 15 07:30:01 I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies
inviso_lfm_tpfreader(3erl)				     Erlang Module Definition					inviso_lfm_tpfreader(3erl)

NAME
inviso_lfm_tpfreader - Inviso Standard Reader Process to Standard Logfile Merger DESCRIPTION
Implements the standard reader process to the standard logfile merger inviso_lfm . The reader process reads logfiles belonging to the same set (normally one node) in chronological order and delivers logged trace messages one by one to the output process. Before any trace messages are delivered, the inviso_lfm_tpreader implementation reads the entire trace information file (if in use) and builds a database over pid-to-alias associations. The inviso_lfm_tpreader implementation is capable of considering that an alias may have been used for several processes during different times. An alias may also be in use for several pids at the same time, on purpose. If a process has generated a trace message, all associa- tions between that pid and aliases will be presented as the list PidMappings in the message sent to the output process. EXPORTS
handle_logfile_sort_wrapset(LogFiles) -> FileList2 Types LogFiles = [{trace_log, FileList}] FileList = FileList2 = [FileName] FileName = string() Only one {trace_log, FileList} tuple is expected in LogFiles , all other tuples are ignored. FileList must: * contain one single file name, or * a list of wraplog files, following the naming convention <Prefix><Nr><Suffix> . Sorts the files in FileList in chronological order beginning with the oldest. Sorting is only relevant if FileList is a list of wraplogs. The sorting is done on finding the modulo-counter in the filename and not on filesystem timestamps. This function is exported for convenience should an own reader process be implemented. THE TRACE INFORMATION FILE PROTOCOL
The format of a trace information file is dictated by the meta tracer process. The inviso_lfm_tpfreader implementation of a reader process understands the following trace information entries. Note that the inviso_rt_meta trace information file is on binary format prefixing every entry with a 4 byte length indicator. {Pid, Alias, alias, NowStamp} : Pid = pid() Alias = term() NowStamp = term() , but in current implementation as returned from erlang:now/0 This message indicates that from now on shall Pid be associated with Alias . {MaybePid, Alias, unalias, NowStamp} : MaybePid = pid() | undefined Alias = term() NowStamp = term() , see above This message indicates that, if MaybePid is a pid, this pid shall no longer be associated with Alias . If it is undefined , all associ- ations with Alias from now shall be considered invalid. Also note that there are many situations where unalias entries will be missing. For instance if a process terminates without making explicit function calls removing its associations first. This is seldom a problem unless the pid is reused. Ericsson AB inviso 0.6.2 inviso_lfm_tpfreader(3erl)
All times are GMT -4. The time now is 07:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy