From oracle-l-bounce@freelists.org Fri Feb 11 19:53:52 2005 Return-Path: Received: from air891.startdedicated.com (root@localhost) by orafaq.com (8.12.10/8.12.10) with ESMTP id j1C1rqLL030681 for ; Fri, 11 Feb 2005 19:53:52 -0600 X-ClientAddr: 206.53.239.180 Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180]) by air891.startdedicated.com (8.12.10/8.12.10) with ESMTP id j1C1rqem030677 for ; Fri, 11 Feb 2005 19:53:52 -0600 Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id A1D1F6FA62; Fri, 11 Feb 2005 19:52:46 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18922-08; Fri, 11 Feb 2005 19:52:46 -0500 (EST) Received: from turing (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 2B3FE6FA5C; Fri, 11 Feb 2005 19:52:46 -0500 (EST) X-Amazon-Corporate-Relay: smtp-out-1002.vdc.amazon.com X-AMAZON-TRACK: oracle-l@freelists.org X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Subject: RE: OT-is there a way to do this in unix - date question Date: Fri, 11 Feb 2005 16:46:55 -0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: OT-is there a way to do this in unix - date question Thread-Index: AcUQiZ5SzAU88yVSRCuSjjO13l0JnAAEb2EQ From: "Parker, Matthew" To: , "Oracle-L" X-archive-position: 16102 X-ecartis-version: Ecartis v1.0.0 Sender: oracle-l-bounce@freelists.org Errors-To: oracle-l-bounce@freelists.org X-original-sender: matthewp@amazon.com Precedence: normal Reply-To: matthewp@amazon.com X-list: oracle-l X-Virus-Scanned: by amavisd-new-20030616-p9 (Debian) at avenirtech.net X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on air891.startdedicated.com X-Spam-Status: No, hits=0.2 required=5.0 tests=AWL autolearn=ham version=2.60 X-Spam-Level: You pretty much had it. Linux #!bin/sh echo `date --date=3D$1/12/2005 +%b` Other Unix OS's #!bin/sh echo `date -d=3D$1/12/2005 +%b` Your script could just ececute this script, however it is probably just = as easy to make it a function call within the shell script itself that = needs this information or a direct variable call to the date funtion = using the original passed variabl or internal variable from your = program. -----Original Message----- From: oracle-l-bounce@freelists.org = [mailto:oracle-l-bounce@freelists.org] On Behalf Of Mark W. Farnham Sent: Friday, February 11, 2005 2:28 PM To: Oracle-L Subject: RE: OT-is there a way to do this in unix - date question #! /bin/sh # Copyleft (C) 2005 Rightsizing, Inc. # # mm2mon -- wrapper for date to return 3 char month abbrev from numeric = arg # with not even a hint of error checking. # # Usage: mm2mon # datedummy=3D`printf 2005%02d01 $1` /usr/bin/date -d$datedummy +%b This seems to work. The returns change based on your local language, = though. If you have a version of the date command that does not take the -d = argument this will laugh at you, otherwise it should work fine. A real shell person may know a cheaper way to format the string than = invoking printf; that part of my brain is off on tape somewhere. I think = you have to give the -d option a formatted string and it will figure out = yymmdd and yyyymmdd. In your case any old yyyy and dd will do. If you want "like what you get with date +%b" then this is actually what = you want. > > wrote: > > without writing a whole series of ifs, given a number 1 - 12 give=20 > > the corresponding three letter month like what you get with date=20 > > +%b, but someone supplies you the digits > > -- > > http://www.freelists.org/webpage/oracle-l -- Peter Johnson Humboldt State University 707-826-6122 -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-l