Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Subtract date & time in diferent rows Post 77511 by vanand420 on Sunday 10th of July 2005 05:07:08 AM
Old 07-10-2005
Subtract date & time in diferent rows

Hi Friends Smilie
I have a long file having fields in the form :
Field1 yy/mm/dd hh:mm:ss Duration(Sec)
line 1) 123123 05/11/30 12:12:56 145
line 2) 145235 05/11/30 12:15:15 30
line 3) 145264 05/11/30 13:14:56 178
.
.
I want to subtract yy/dd/dd hh:mm:ss in line (2) from yy/mm/dd hh:mm:ss in line (1) and compare the result(in seconds) with the duration(sec) of line(1).
and echo a message whether it is < or >. I want to apply this to the long file This can be done easily in excel as we usually drag a formula in excel. But in unix how I don't know.
Please Dont refer me to Datecalc as I want specific script to do so.
Thanks In advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Time & Date Command

Hey all, When you run the 'ls -la' command it'll show you the time and dates of all files/directories. Now what I am trying to do is create a script that will tell me what files haven't been used in over the past 1 month and what the time and date is that the files that haven't been accessed in... (2 Replies)
Discussion started by: merlin
2 Replies

2. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

3. Shell Programming and Scripting

About date & time difference

Hello All, I was having a look on threads on the Forum about time calculation but didn't find exactly this issue. For instance, if we have these 2 dates, begin & end : 20100430235830 20100501000200 Is there anyway, awk, ksh, perl to calculate the difference in sec and get for... (6 Replies)
Discussion started by: rany1
6 Replies

4. Programming

DATE & TIme

Can we select the datetime from oracle database in “hhmmssnnnccyymmdd” format ? please help to solve this..... (2 Replies)
Discussion started by: Sanal
2 Replies

5. Shell Programming and Scripting

Script to subtract rows HELP

Dear All, Please help with a script which can accomplish the following: Input table: $1 $2 $3 Student1 1 50 Student2 56 75 Student3 77 100 Desired Output: $1 $2 $3 $4 Student1 1 50 Student2 56 75 6 Student3 77 ... (4 Replies)
Discussion started by: saint2006
4 Replies

6. UNIX for Dummies Questions & Answers

Removing duplicate rows & selecting only latest date

Gurus, From a file I need to remove duplicate rows based on the first column data but also we need to consider a date column where we need to keep the latest date (13th column). Ex: Input File: Output File: I know how to take out the duplicates but I couldn't figure out... (5 Replies)
Discussion started by: shash
5 Replies

7. Shell Programming and Scripting

multiple and diferent printf(s) for diferent fields in awk

Hi, I'm trying to print and outrput of a timestamp from a script i did that calcs de time diference betwen 2 timestamps in the format HH:MM:SS and i properly formated it with printf inside awk, but i can't do it with separate statements. This works fine, but can you explaim-me how to do it... (2 Replies)
Discussion started by: grafman
2 Replies

8. Shell Programming and Scripting

Subtract two rows (in Time format)

Hello all, I have written sth like this: #!/bin/bash grep -e XXX -e YYYY myfile.log | grep -v ZZZ | awk '{print $1 " " $2 ";" $3 ";" $9 ";" $11}' > myfile.csv sed -i '1iDate;Time;From;To' myfile.csv => it is clear that it converts log to csv and add a header. Now I want to subtract row... (4 Replies)
Discussion started by: frhling
4 Replies

9. Shell Programming and Scripting

Date command - subtract from given time

the given time is: 12:13:00 how do i subtract a 10 minutes from any given time? date '12:13:00' '-10 min' also tried this: date +12:13:00 '-10 min' (2 Replies)
Discussion started by: SkySmart
2 Replies

10. UNIX for Dummies Questions & Answers

How to chnage format and subtract time and date and get average.?

Hello All , Please support for below request how to change format and subtract time and date and get average. xxx 13-OCT-15 11.32.18.241000 AM 13-OCT-15 11.35.49.089080 AM xxx 13-OCT-15 11.32.24.000000 AM 13-OCT-15 11.45.17.810904 AM xxx 13-OCT-15 11.32.25.232000 AM ... (1 Reply)
Discussion started by: mirwasim
1 Replies
GPIV_T-AVG-IMG(1)					      General Commands Manual						 GPIV_T-AVG-IMG(1)

NAME
gpiv_t-avg-img - Calculates time-averaged intensities from a series of images at each pixel. SYNOPSIS
gpiv_t-avg-img [-c int] [-fb string] [-ff int] [-fl int] [-fx] [-help] [-p | --print] [-r int] [-s] [-v] < stdin > stdout DESCRIPTION
gpiv_t-avg-img calculates time-averaged intensities from a series of images for each pixel. This program uses the GENPAR parameters. Options -c NCOLS Number of columns. -fb FILE File base-name (without .number.r extension) instead of stdin and stdout. -ff N Number of first image file. -fl N Number of last image file. -fx Prefix numbering to file base name. -help | --help On-line help. -p | --print Prints parameters, command line options and input and output filenames to stdout. -r NROWS Number of rows. -s Subtract mean from input data. -v | --version Prints version information to standard output, then exits successfully. SEE ALSO gpivtools AUTHOR
Gerber Van der Graaf 19 Januari 2005 GPIV_T-AVG-IMG(1)
All times are GMT -4. The time now is 08:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy