Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Sightly OT: Unix scripting
I'll show you one way to do it, if you quit calling that a Julian date. :)
( YYDDD is not a Julian date )
$> echo $DATE
2079
$> DATE=$(echo $DATE | awk '{ print substr("0000"$1,length("0000"$1)-4)
}')
$> echo $DATE
02079
Jared
"Ball, Terry" <TBall_at_birch.com>
Sent by: root_at_fatcity.com
03/21/02 11:08 AM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: Subject: Sightly OT: Unix scripting
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: INET: Jared.Still_at_radisys.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).Received on Thu Mar 21 2002 - 14:33:27 CST