Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Sightly OT: Unix scripting

Re: Sightly OT: Unix scripting

From: Alex <axs_at_m-net.arbornet.org>
Date: Fri, 22 Mar 2002 10:18:25 -0800
Message-ID: <F001.004310C7.20020322101825@fatcity.com>


try...

y=`date '+%y'`
j=`date '+%j'`
#DATE=`date '+%y%j'`

#echo $DATE
ystr=`expr $y - 1`
echo $ystr
if [ ${#ystr} -eq 1 ]

   then
   ystr=0$ystr
   echo $ystr
fi
DATE=$ystr$j
echo $DATE

On Thu, 21 Mar 2002, Ball, Terry wrote:

> Environment: Oracle 8.1.6.3 on Solaris 5.8
>
> I am not a Unix Guru by any strech of the imagination, so I can use all the
> help I can get. I am trying to write a shell script to execute sqlldr of a
> file whose name includes yesterday's 2 digit year and julian day in the
> format: file_yyjjj.csv. I can get today's date fine by setting a variable
> to be DATE=`date '+%y%j'`
>
> But when I try to get DATE -1 it strips the leading 0 (since it is currently
> 02). Does anyone have any suggestions as to how I can retain the leading 0
> and still get yesterday's date?
>
> TIA,
>
> Terry
>
> Terry Ball, DBA
> Birch Telecom
> Work: 816-300-1335
> FAX: 816-300-1801
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Ball, Terry
> INET: TBall_at_birch.com
>
> 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: ListGuru_at_fatcity.com (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: Alex
  INET: axs_at_m-net.arbornet.org

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: ListGuru_at_fatcity.com (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).
Received on Fri Mar 22 2002 - 12:18:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US