The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Server goes down regularly- Please help bsandeep_80 UNIX for Advanced & Expert Users 7 07-28-2008 01:43 AM
changing date manoj.solaris Linux 1 09-12-2007 04:27 PM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 06:15 AM
Changing the date to EST shiroh_1982 Shell Programming and Scripting 2 07-17-2006 03:07 AM
changing the date JBX UNIX for Dummies Questions & Answers 2 09-13-2001 08:23 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-08-2008
Registered User
 

Join Date: Jun 2007
Posts: 80
Changing date regularly..

Hi Guys,
Plzz help me out in this!!!!!!!!!!!!!!!!

I have a file which runs in the back ground using crontab for every monday at5 P.M. The problem is inside the file ...

This is a sample content of a file

Update the current and previous week: (Sunday to Sunday)
%let wk_curr=20070930;
%let wk_prev=20070923


Here i need to change the dates regularly i.e. every week. before the job starts running on monday..

(20070923 is a sunday and also 20070930 is a sunday)

so wen the job runs for th next time, i need the dates to be like

%let wk_curr=20071007;
%let wk_prev=20070930;


there is no problem if the dates are changing within a month but in the case of last date of the month ,its not getting updated properly..


plzzz guide me in this as it s very urgent


Regards,
Anand
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-08-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
man date and/or Yesterdays Date/Date Arithmetic from this site's FAQ section.
Reply With Quote
  #3 (permalink)  
Old 10-08-2008
Registered User
 

Join Date: Jun 2007
Posts: 80
HI,
I checked out but am not able to find the answer..Please guide me in this
Reply With Quote
  #4 (permalink)  
Old 10-08-2008
RahulJoshi's Avatar
Registered User
 

Join Date: Aug 2008
Location: PUNE
Posts: 95
today=`date +"%Y%m%d"`
echo "$today" > /var/tmp/NEWDATEFILE
echo "current date= $today"
olddate=`cat /var/tmp/NEWDATEFILE`
echo "privious date= $olddate"
####################
#your main logic
####################
Reply With Quote
  #5 (permalink)  
Old 10-08-2008
Registered User
 

Join Date: Jun 2007
Posts: 80
Hi Rahul,
Thanks for the reply..Have done this part but i need to the generate dates periodically.plzz help me out in this
Reply With Quote
Google The UNIX and Linux Forums
Reply

Bookmarks

Tags
None

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 05:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66