Suhen,
If all you want is a format check (and no date validation) here is a way to
do it:

#!/usr/bin/ksh
REQD=ZZ-ZZZ-ZZ

RCVD=`echo $1| tr '[A-Z] | [a-z] | [0-9]' '[Z*]'`   

if [ $REQD = $RCVD ]
then
  echo "Input Format is Okay"
else
  echo "Input Format is WRONG"
fi


HTH,

Regards,

- Kirti Deshpande 
  Verizon Information Services
   http://www.superpages.com

> -----Original Message-----
> From: Suhen Pather [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, October 26, 2001 7:40 PM
> To:   Multiple recipients of list ORACLE-L
> Subject:      RE: date format in ksh
> 
> Jared,
> 
> Thanks for the reply.
> I am passing a hardcoded date.
> I am not getting a date from the 
> "date" command in ksh.
> 
> What my ksh does is retrieves $1 and must check if the date format
> is in DD-MON-YY eg. 02-FEB-01.
> It uses the hardcoded date (passed in as argument 1) in the script.
> If the date is in another format other than above then it must exit.
> 
> Regards
> Suhen
> 
> 
> 
> 
> 
> date +%d-%b-%Y
> 
> man date.
> 
> You may have to look at the man page on a system with more
> recent documentation, such as linux.  The man page on
> Solaris is incomplete.
> 
> JARed
> 
> 
> 
> 
>  
> 
>                     Suhen Pather
> 
>                     <Suhen.Pather@strandba       To:     Multiple
> recipients
> of list ORACLE-L <[EMAIL PROTECTED]>        
>                     gs.com.au>                   cc:
> 
>                     Sent by:                     Subject:     date format
> in
> ksh                                            
>                     [EMAIL PROTECTED]
> 
>  
> 
>  
> 
>                     10/25/01 08:00 PM
> 
>                     Please respond to
> 
>                     ORACLE-L
> 
>  
> 
>  
> 
> 
> 
> 
> 
> List,
> 
> 
> 
> 
> 
> Sorry to deviate from the topic, but
> 
> 
> I am writing a korn shell script that would exit if the date format is
> 
> 
> incorrect.
> 
> 
> 
> 
> 
> I just need something to compare the date format passed  in with
> DD-MON-YYYY.
> 
> 
> 
> 
> 
> Eg.
> 
> 
> I am passing an argument to my ksh script being the date.
> 
> 
> If the date is in any other format but DD-MON-YYYY the ksh must exit.
> 
> 
> 
> 
> 
> Eg.  sh test.ksh 02/05/1999
> 
> 
> 
> 
> 
> It must exit.
> 
> 
> 
> 
> 
> The only format excepted should be
> 
> 
> sh test.ksh 02-MON-YYYY
> 
> 
> 
> 
> 
> TIA
> 
> 
> 
> 
> 
> Regards
> 
> 
> Suhen
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Suhen Pather
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California        -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Deshpande, Kirti
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to