date comparision | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

date comparision

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-04-2006
Hitesh Shah Hitesh Shah is offline
Registered User
 
Join Date: Oct 2002
Last Activity: 22 October 2009, 2:51 AM EDT
Location: India
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
date comparision

I am wriitng a shell script to compare a date in `date +%Y%m%d%H%M` to the output of `cat /var/adm/messages.0 | grep Temp |grep "CPU Fans" | cut -f1-4,19 -d' '` which looks like

Dec 2 11:30:57 79
Dec 2 11:37:58 79
Dec 2 11:44:58 79
Dec 2 11:50:59 79
Dec 2 11:58:00 79
Dec 2 12:05:01 79
Dec 2 12:11:01 79
Dec 2 12:18:02 79
Dec 2 12:21:02 80

How can I do this . My main issue is abbreviated month description .

Many thanks in advance
Sponsored Links
    #2  
Old 10-26-2007
dave_nithis dave_nithis is offline
Registered User
 
Join Date: Sep 2007
Last Activity: 8 September 2009, 3:07 AM EDT
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Data Compare two dates using shell scripting

a=2007-05-10 (YYYY-DD-MM Format)
b=2007-06-10

These are the two given dates and I need to compare.
(First It should split the dates into YYYY,dd,mm)

The script should first compare years(2007 here).If both are same or if "a" is lesser than "b"(ie.suppose year in "a" is 2006),it should print correct.If "a"(ie. suppose year in a is 2008) is greater than b,then it should print error.Similarly for the dates(05 and 06).

No need to check for the months(10).

Regards,
Dave Nithis.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Date comparision in Unix pdreddy34 Shell Programming and Scripting 1 03-22-2012 06:01 AM
Date Manipulation and Comparision sol_nov Shell Programming and Scripting 1 06-07-2010 02:05 AM
Problem with date comparision in Pro*C sureshbabuc Programming 4 03-25-2010 12:16 AM
Problem with Date Comparision Raji_gadam Shell Programming and Scripting 2 07-27-2009 10:58 PM
date comparision kotasateesh UNIX for Dummies Questions & Answers 3 07-20-2007 11:25 AM



All times are GMT -4. The time now is 10:08 PM.