Sponsored Content
Full Discussion: Timestamp comparison
Top Forums Shell Programming and Scripting Timestamp comparison Post 302160211 by Ygor on Monday 21st of January 2008 07:28:12 AM
Old 01-21-2008
Try...
Code:
#! /usr/bin/awk -f

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

$7 ~ /Completed/ {
  n=split($1,et_split,".")
  st = (st_split[1]*60*60) + (st_split[2]*60) + st_split[3]
  et = (et_split[1]*60*60) + (et_split[2]*60) + et_split[3]
  d = et - st
  if ( d < 0 ) {
    d += 24*60*60
  }
  if ( d > (15*60)) {
    printf "Duration %02d.%02d.%02s: %s\n", d/60/60, d/60%60, d%60, $0
  }
}

 

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
fmemcmpi(3)						     Library Functions Manual						       fmemcmpi(3)

NAME
fmemcmpi - fuzzy comparison of two memory areas SYNOPSIS
#include <fstrcmp.h> #define FSTRCMPI_IDENTICAL #define FSTRCMPI_THRESHOLD #define FSTRCMPI_ERROR int fmemcmpi(const void *data1, size_t size1, const void *data2, size_t size2); DESCRIPTION
The fmemcmpi() function compares the two memory areas, the size1 bytes pointed to by data1 and the size2 bytes pointed to by data2. RETURN VALUE
The fmemcmpi function returns an int value between 0 and FSTRCMPI_IDENTICAL. A value of 0 means the memory areas are utterly un-alike. A value of FSTRCMPI_IDENTICAL means the memory areas are identical. A value of more than FSTRCMPI_THRESHOLD (it lies between 0.0 and FSTR- CMP_IDENTICAL) would be considered "similar" by most people. A value of FSTRCMPI_ERROR (always negative) indicates a malloc(3) failure. SEE ALSO
fmemcmp(3) fuzzy comparison of two memory areas fstrcmpi(3) fuzzy comparison of two strings memcmp(3) compare memory areas COPYRIGHT
fstrcmp version 0.4 Copyright (C) 2009 Peter Miller Peter Miller <pmiller@opensource.org.au> The comparison code is derived from the fuzzy comparison functions in GNU Gettext 0.17. The GNU Gettext comparison functions were, in turn, derived from GNU Diff 2.7. Copyright (C) 1988-2009 Free Software Foundation fmemcmpi(3)
All times are GMT -4. The time now is 03:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy