Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Two dates comparision in AIX Post 302824421 by Chubler_XL on Thursday 20th of June 2013 11:54:57 PM
Old 06-21-2013
Yoda, posted solution doesn't work for
12-MAR-13 and 14-DEC-03
or
2-JUN-13 and 14-APR-13

To correct, you could use the following replacement for the D1 and D2 assignments:

Code:
a="12-MAR-13"
b="14-DEC-03"

awk -v A="$a" -v B="$b" '
BEGIN {
        j = split("JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC",M,",")
        split(A,m,"-")
        split(B,n,"-")
        for ( i = 1; i <= j; i++ )
        {
                if(M[i]==m[2])
                        D1=sprintf("%02d%02d%04d", m[3], m[1], i)
                if(M[i]==n[2])
                        D2=sprintf("%02d%02d%04d", n[3], n[1], i)
        }
        if(D1>D2)
                print A " is greater"
        else
                print B " is greater"
}'


Last edited by Chubler_XL; 06-21-2013 at 01:06 AM..
This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Vmstat VS PS comparision not match --need help in urgent AIX

Hi I have a AIX box, People seatting and looking out for the vmstat and PS CPU % use there . Problem is that : they used vmstat and looked for the cpu clolumn which basically have column like cs us sy id ... (1 Reply)
Discussion started by: jambesh
1 Replies

2. Shell Programming and Scripting

Need script to generate all the dates in DDMMYY format between 2 dates

Hello friends, I am looking for a script or method that can display all the dates between any 2 given dates. Input: Date 1 290109 Date 2 010209 Output: 300109 310109 Please help me. Thanks. :):confused: (2 Replies)
Discussion started by: frozensmilz
2 Replies

3. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

4. Programming

SQL: find if a set od dates falls in another set of dates

Don't know if it is important: Debian Linux / MySQL 5.1 I have a table: media_id int(8) group_id int(8) type_id int(8) expiration date start date cust_id int(8) num_runs int(8) preferred_time int(8) edit_date timestamp ON UPDATE CURRENT_TIMESTAMP id... (0 Replies)
Discussion started by: vertical98
0 Replies

5. Emergency UNIX and Linux Support

Replacing dates]] with (dates)]]

Hi guys, For my wiki site I need to fix 1400 pages that use the wrong date format, most pages (not all) use eg. 1988]] I need to change that to (1988)]] The date range goes back to 1400 so I guess I need to do the following ssh into my server, dump mysql database vi .sql dump search... (20 Replies)
Discussion started by: lawstudent
20 Replies

6. Shell Programming and Scripting

[Solved] AIX ksh script -d <- what does it mean?

I'm looking at a line in a script: && DRROOT="/dir1" || DRROOT="/dir2" I'm trying to understand it. Is there a "-d" command and is it seeing if /dir1 exists and, if so, set an environment variable named DRROOT to "/dir1", else set DRROOT to "/dir2" ? Thanks, -dog ---------- Post... (0 Replies)
Discussion started by: landog
0 Replies

7. UNIX for Dummies Questions & Answers

How to write the dates between 2 dates into a file

Hi All, I am trying to print the dates that falls between 2 date variables into a file. Here is the example. $BUS_DATE =20120616 $SUB_DATE=20120613 Output to file abc.txt should be : 20120613,20120614,120120615,20120616 Can you pls help me accomplish this in LINUX. Thanks... (5 Replies)
Discussion started by: dsfreddie
5 Replies

8. Shell Programming and Scripting

Generating dates between two dates

HI, i have row like this HHH100037440313438961000201001012012073110220002 N in this i have 2 dates in pos 25-32 and 33-40 , so based upon the se two dates , i need to generated records between these two values so in the above record 20100101 and 20120731 need to genearte rows like this... (4 Replies)
Discussion started by: sathishsr
4 Replies

9. UNIX for Advanced & Expert Users

How to get the Missing dates between two dates in the table?

Hi Am Using Unix Ksh ... I have a Table called date select * from date ; Date 01/02/2013 06/02/2013 I need the output as Missing Date 01/02/2013 02/02/2013 03/02/2013 04/02/2013 05/02/2013 06/02/2013 (2 Replies)
Discussion started by: Venkatesh1
2 Replies

10. Shell Programming and Scripting

Display dates between two dates

Hi All, I have 2 dates in mm/dd format. sdate=10/01 (October 01) edate=10/10 (October 10) I need the dates in between these 2 dates like below. 10/01 10/02 10/03 10/04 10/05 10/06 10/07 10/08 (1 Reply)
Discussion started by: jayadanabalan
1 Replies
APR-1-CONFIG(1) 						   User Commands						   APR-1-CONFIG(1)

NAME
apr-1-config - Return metainformation about apr library SYNOPSIS
apr-1-config [OPTION] DESCRIPTION
The apr-1-config program is used to retrieve information about the apr library in the system. It is typically used to compile and link against the library. When linking with libtool, an application should do something like: APR_LIBS="`apr-1-config --link-libtool --libs`" or when linking directly: APR_LIBS="`apr-1-config --link-ld --libs`" An application should use the results of --cflags, --cppflags, --includes, and --ldflags in their build process. OPTIONS
Known values for OPTION are: --prefix[=DIR] change prefix to DIR --bindir print location where binaries are installed --includedir print location where headers are installed --cc print C compiler name --cpp print C preprocessor name and any required options --cflags print C compiler flags --cppflags print C preprocessor flags --includes print include information --ldflags print linker flags --libs print additional libraries to link against --srcdir print APR source directory --installbuilddir print APR build helper directory --link-ld print link switch(es) for linking to APR --link-libtool print the libtool inputs for linking to APR --shlib-path-var print the name of the shared library path env var --apr-la-file print the path to the .la file, if available --apr-so-ext print the extensions of shared objects on this platform --apr-lib-target print the libtool target information --apr-libtool print the path to APR's libtool --version print the APR's version as a dotted triple --help print the help AUTHOR
This manual page was written by Vincent Danjean <Vincent.Danjean@ens-lyon.org> for the Debian project (but may be used by others). apr-1-config 1.2.2 March 2006 APR-1-CONFIG(1)
All times are GMT -4. The time now is 09:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy