Sponsored Content
Full Discussion: Comparing two timestamps
Top Forums Shell Programming and Scripting Comparing two timestamps Post 302676071 by Scott on Tuesday 24th of July 2012 04:06:44 AM
Old 07-24-2012
Remove the colons from the dates. They're not numeric, and you're doing a numeric comparison.

Alternatively:
Code:
  while [ ${a//:} -le ${b//:} ]; do
    ..
  fi

  ..


Last edited by Scott; 07-24-2012 at 05:27 AM.. Reason: Changed if-then to while-do
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix timestamps

Can someone help me with a Unix or perl script to convert the unix timestamps to human readable format? Any help will be highly appreciated... (3 Replies)
Discussion started by: hamsasal
3 Replies

2. Solaris

Difference between two timestamps

I'm writting a script to find the difference between two timestamp. One field i get on delivery time of the file like 07:17 AM and other is my SLA time 06:30 AM I need to find the difference between these two time (time exceeded to meet SLA). Need some suggestions. (8 Replies)
Discussion started by: raman1605
8 Replies

3. Shell Programming and Scripting

timestamps

Hello! I have the following problem. I read a file using perl, each line of this file has the fllowing format. 14/4/2008 8:42:03 πμ|10800|306973223399|4917622951117|1||1259|1|126|492|433||19774859454$ Th first field is the timestamp and the second field is the offset in seconds. How can... (1 Reply)
Discussion started by: chriss_58
1 Replies

4. Shell Programming and Scripting

Arithmetic on timestamps

Hi Friends, please advise on shell script to add two time stamps for example : a=12:32 b=12:00 c=a+b=00:32 please help me to find shell script to add to two time stamps, as i need to convert time from EST to GMT or SST to prepare status of jobs in unix and to specify estimated time to... (3 Replies)
Discussion started by: balireddy_77
3 Replies

5. Shell Programming and Scripting

Compare Timestamps

Hi! Long time reader first time registered user and poster. I've picked up some times and tricks and I'm at a dead end... I've parsed a log file for duplicates and printed only the two fields I need (duplicate entry and time stamp). My question is, with this output, how would I script... (2 Replies)
Discussion started by: rexpokinghorn
2 Replies

6. UNIX for Dummies Questions & Answers

Compare 2 timestamps

Hi, i have current timestamp, lets say "12:02:45" in an variable (var1) and another timestamp "08:30:00" fetched from table in another variable2 (var2). How do i compare 2 timestamps in unix shell scripting. if var 1 > var 2 then echo message. Thanks in advance. (3 Replies)
Discussion started by: prasannarajesh
3 Replies

7. Shell Programming and Scripting

Help with touch and timestamps

Hello fellow Unix geeks, I have been given a very urgent assignment in my office on writing a particular Shell script but I'm very much new to it.I would appreciate any help from you on solving this problem--which might seem very trivial to you. The Unix flavour is a Sun Solaris one..(not... (6 Replies)
Discussion started by: Digjoy83
6 Replies

8. Shell Programming and Scripting

Issues with comparing 2 files timestamps

Hi, Im trying to write a script to first check a directory and if the filename has "ACK" in it do nothing and exit but if it has "ORD" in the filename then compare it with a dummy file created 2 minutes previous and see which one is newer Im getting a few errors which im unsure how to rectofy... (5 Replies)
Discussion started by: 02JayJay02
5 Replies

9. Shell Programming and Scripting

Finding difference in 2 different timestamps

Legends, I have a requirement to run the script exactly after one hour of completion of dependent script. Eg: Script B should run after one hour on the completion of Script A. I got the time stamps using following variables. these scripts runs in autosys > DATE=`date +%H:%M` >... (4 Replies)
Discussion started by: sdosanjh
4 Replies

10. Shell Programming and Scripting

Write with a look for timestamps

hello i'm using SOX to generate a spectrogram from a wave file with the command : #sox file.wav -n spectrogram is there a way to create a spectrogram using the same command but reading file timestamps instead of the namefile.wav , since name is changing every 4 hours? (it's saved with... (2 Replies)
Discussion started by: Board27
2 Replies
Excel::Template::Container::Conditional(3pm)		User Contributed Perl Documentation	      Excel::Template::Container::Conditional(3pm)

NAME
Excel::Template::Container::Conditional - Excel::Template::Container::Conditional PURPOSE
To provide conditional execution of children nodes NODE NAME
IF INHERITANCE
CONTAINER ATTRIBUTES
o NAME This is the name of the parameter to test. It is resolved like any other parameter name. (q.v. VAR for more info.) o VALUE If VALUE is set, then a comparison operation is done. The value of NAME is compared to VALUE using the value of OP. o OP If VALUE is set, then this is checked. If it isn't present, then '==' (numeric equality) is assumed. OP must be one of Perl the numeric comparison operators or the string comparison operators. All 6 of each kind is supported. Note: If you want to use < or <=, you must instead use &lt; or &lt;=. This is to make sure it will parse with XML::Parser. You should not need to use &gt; or &gt;= instead of > and >=, respectively. o IS If VALUE is not set, then IS is checked. IS is allowed to be either "TRUE" or "FALSE". The boolean value of NAME is checked against IS. CHILDREN
None EFFECTS
None DEPENDENCIES
None USAGE
<if name="__ODD__" is="false"> ... Children here </if> In the above example, the children will be executed if the value of __ODD__ (which is set by the LOOP node) is false. So, for all even iterations. AUTHOR
Rob Kinyon (rob.kinyon@gmail.com) SEE ALSO
LOOP, VAR perl v5.14.2 2010-06-17 Excel::Template::Container::Conditional(3pm)
All times are GMT -4. The time now is 09:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy