![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| adding or subtracting days in the o/p of date | St.Fartatric | UNIX for Dummies Questions & Answers | 1 | 05-19-2008 04:10 AM |
| Cron to run first day of month to calculate date 3 months ago | new2ss | Shell Programming and Scripting | 1 | 05-16-2007 11:28 PM |
| Subtract 2 months from the date | mahekr2000 | UNIX for Advanced & Expert Users | 5 | 07-23-2006 09:01 AM |
| Subtracting date / timestamps | roadcyclist | Shell Programming and Scripting | 0 | 06-21-2006 11:51 AM |
| subtracting a days from current date | rameshspal | Shell Programming and Scripting | 1 | 03-09-2006 09:18 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Subtracting Two months from date
Hello:
I am running a script that creates a database and renames the output file to append the current date in month-year format. However, I need to append the date with todays date minus two months. For example: Aug2002 should read Jun2002. Here is a copy of my current script: Code:
--------------------------------------------------------------------------------- #!/bin/sh #Build cube rsserver -c -m/global/site/vendor/cognos/Dealerops/models/historymodels/oduchistorydomclosmo.mdl -DLogFileName=/global/site/vendor/cognos/Dealerops/log/histcur.log -kODUCDB2U=cognos/songoc01 #Set Date Variable for appending date to file name (month-year format) cogdate="`date +%h%Y`" #Set Return Status variable ret_stat=$? #Check the return status of rsserver, if okay, do the necessary file transfers # and update the cube on PPES and make mail subject "SUCCESS". # Otherwise, change mail subject to "FAILURE" if test $ret_stat -eq 0 then subject="HistoryCubeBuild:SUCCESS" cd /global/site/vendor/Dealerops/cubes cp ODUCHISTDOMCUR.mdc /global/site/vendor/Dealerops/cubes/History/HISTCUR"$cogdate".mdc else subject="HistoryCubeBuild:FAILURE" fi MailToNames="XXXX.com" OutputFile=/global/site/vendor/Dealerops/log/histcur.log cat $OutputFile | mailx -s $subject $MailToNames exit $ret_stat Last edited by oombera; 02-18-2004 at 09:12 AM. |
| Forum Sponsor | ||
|
|
|
|||
|
Tool is not available. I am working in a production environment and cannot add utilities.
What this script is doing is calling an OLAP database kernel that generates financial numbers for a financial closing of two months prior to the system date. The filename must be in sync with the record dates in the database source. Therefore, If System Month = Jan, then New Month = Nov, etc. Perhaps it is best to converrt the month to number. Any ideas or scripts someone can share? Thanks, Newbie |
|||
| Google UNIX.COM |