01-21-2014
Comparing dates in shell script
Hi All,
I have a date variable say dt="2014-01-06 07:18:38"
Now i need to use this variable to search a log and get the entries which occured after that time.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI,
I am able to find days difference using FIND command. However it is comparing between today and the last time it was modified.
I now need to find the difference between a date specified by myself and the last time the file was modified. Is there a command which I can use or I have to... (1 Reply)
Discussion started by: scmay
1 Replies
2. Shell Programming and Scripting
hi ,
I have two variables both containg dates,
x= `date`
and
y= `date'
their format being -> Fri Nov 12 22:59:50 MST 2004
how do I compare which one is greater.
->Can dates be converted into integer and then compared?
( one lengthy way would be to compare the words one by... (7 Replies)
Discussion started by: k_oops9
7 Replies
3. Programming
hi
is there a c function in linux for comparing dates.
thanx in advance.
svh (2 Replies)
Discussion started by: svh
2 Replies
4. Shell Programming and Scripting
Hi All.
Can someone please give me an example of how I'd do a comparison to find out if the last modified date of a file is newer than yesterday (i.e. today - 1 day)?
Example:
if ; then
echo "Do something..."
fi
Any ideas or examples?
Thanks. (1 Reply)
Discussion started by: dmilks
1 Replies
5. Shell Programming and Scripting
Hi,
Can some one guide me how to compare two dates in unix.
TIA
Gupta (5 Replies)
Discussion started by: guptan
5 Replies
6. Shell Programming and Scripting
Hi guys
I have a a variable called check_ts which holds a date value. this date value keeps refreshing every 15 minutes.
I am going to start a cron job 5 minutes after the refresh. I have to check if the current date > 20 min of check_ts. how do i do that.
thanks
ragha (17 Replies)
Discussion started by: ragha81
17 Replies
7. UNIX for Dummies Questions & Answers
Hi I have yesterday date and todays date stored in two variables.
Today date is stored in variable -- testdate=`date +%m/%d/%Y`
I found the yesterday date and stored in variable -- ydate=$month'/'$day1'/'$year
Now i am trying to find out whether $testdate is less that $ydate.
I am... (6 Replies)
Discussion started by: intiraju
6 Replies
8. Shell Programming and Scripting
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.One more condition is change of year also i.e today is Jan1 2012 and yesterday is Dec 31 2011.
The above rek i want in Shell... (4 Replies)
Discussion started by: kumarmsk1331
4 Replies
9. Shell Programming and Scripting
Hi
I'm trying to compare the current date (dd-Mmm-yyyy) against a variable that is an extracted date from an sql script. Below is the code:
datenow=`date '+%d-%h-%Y'`
#datenow is the current date in the format dd-Mmm-yyyy
sqlplus $dbuserid/$dbpassword @ $SCRIPT_PATH/business-date.sql >... (3 Replies)
Discussion started by: joyAV
3 Replies
10. UNIX for Dummies Questions & Answers
Hi,
can we do date comparisons in unix? like if i give the two dates find which date is old one and which is new one and difference between the two dates in terms of hours,minutes,days and months. (1 Reply)
Discussion started by: vmachava
1 Replies
doctools::cvs(n) Documentation tools doctools::cvs(n)
__________________________________________________________________________________________________________________________________________________
NAME
doctools::cvs - Processing text in 'cvs log' format
SYNOPSIS
package require Tcl 8.2
package require textutil
package require doctools::cvs ?1?
::doctools::cvs::scanLog text evar cvar fvar
::doctools::cvs::toChangeLog evar cvar fvar
_________________________________________________________________
DESCRIPTION
This package provides Tcl commands for the processing and reformatting text in the format generated by the cvs log command.
The commands ::doctools::cvs::scanLog and ::doctools::cvs::toChangeLog are derived from code found on the Tcl'ers Wiki
[http://wiki.tcl.tk]. See the references at the end of the page.
API
::doctools::cvs::scanLog text evar cvar fvar
The command takes the text and parses it under the assumption that it contains a CVS log as generated by cvs log. The resulting
information is stored in the variables whose names were specified via evar, cvar, and fvar.
Already existing information in the referenced variables is preserved, allowing the caller to merge data from multiple logs into one
database.
varname evar (in)
Has to refer to a scalar variable. After the call this variable will contain a list of all the entries found in the log file.
An entry is identified through the combination of date and author, and can be split over multiple physical entries, one per
touched file.
It should be noted that the entries are listed in the same order as they were found in the text. This is not necessarily
sorted by date or author.
Each item in the list is a list containing two elements, the date of the entry, and its author, in this order. The date is
formatted as year/month/day.
varname cvar (in)
Has to refer to an array variable. Keys are strings containing the date and author of log entries, in this order, separated
by a comma.
The values are lists of comments made for the entry.
varname fvar (in)
Has to refer to an array variable. Keys are strings containing date, author of a log entry, and a comment for that entry, in
this order, separated by commas.
The values are lists of the files the entry is touching.
::doctools::cvs::toChangeLog evar cvar fvar
] The three arguments for this command are the same as the last three arguments of the command ::doctools::cvs::scanLog. This com-
mand however expects them to be filled with information about one or more logs. It takes this information and converts it into a
text in the format of a ChangeLog as accepted and generated by emacs. The constructed text is returned as the result of the command.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category doctools
of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for
either package and/or documentation.
SEE ALSO
http://wiki.tcl.tk/log2changelog
KEYWORDS
changelog, cvs, cvs log, emacs, log
CATEGORY
Documentation tools
COPYRIGHT
Copyright (c) 2003-2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>
doctools 1 doctools::cvs(n)