The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cron to run first day of month to calculate date 3 months ago new2ss Shell Programming and Scripting 1 05-17-2007 03:28 AM
Subtract date & time in diferent rows vanand420 UNIX for Dummies Questions & Answers 1 07-10-2005 09:07 AM
Subtract two date in unix vanand Shell Programming and Scripting 1 06-18-2005 08:19 AM
Subtracting Two months from date jwatson12 UNIX for Dummies Questions & Answers 3 09-13-2002 02:06 PM
How to subtract 2 hours from 'date' in shell ( /bin/sh ) script ? yairon UNIX for Dummies Questions & Answers 1 06-07-2001 04:23 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-21-2006
mahekr2000 mahekr2000 is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 2
Unhappy Subtract 2 months from the date

I have the script which appends month and year to the name of the
file. Now every time when I append the month-year combination I
have to subtract 2 months from the current date and then append
it, since we are sending our vendor 2 months prior worth of data
eveytime.

#! /usr/bin/ksh

filefullname=$1
filename=${filefullname%.*}
fileext=${filefullname##*.}

DATE=`date +%m%y`

newfilename="${filename}${DATE}.${fileext}"

mv $filefullname $newfilename

I am not sure how to go about it, Any help or sample script would help me get going...

Thanks..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0