Future dates.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Future dates.
# 1  
Old 07-14-2010
Future dates.

If I have a script that writes the name of the file based on today, tomorrow, and the day after tomorrow. How would I modify the line
Code:
 echo "filename.${PDY}${CYC}"               >>CONTROL

to reflect tomorrow and the day after tomorrow and write it to the file called CONTROL? Since
Code:
 ${PDY}

shows the year month and day.
# 2  
Old 07-14-2010
# 3  
Old 07-15-2010
UTC yesterday & Today.

THis is not really applicable to me. I have been trying to figure out what is going on with my program. It turns out the program is using UTC which I knew. The problem is that the initialization starts on a different day since I am HST for the time that comes out at 12noon. This means, I need to have yesterdays date in UTC for the initialization time. I also need to export the files and label them according to yesterday, today, and tomorrow in UTC in the form year month and date as is 20100715. I have placed PDY-1 for yesterday and PDY+1 for tomorrow but only PDY works which is today. This is what I have
Code:
 # meteorology directory for today
  DAT="/directory/"
  YR=`echo ${PDY} | cut -c3-4`
  MO=`echo ${PDY} | cut -c5-6`
  DA=`echo ${PDY} | cut -c7-8`

# check for availability of current forecast
  if [ -f ${DAT}file1.${PDY-1}${CC} ]; then
     CYC=${CC}
  else
     CYC=${PC}
  fi

# create the first part of the control file
  echo "${YR} ${MO} ${DA} ${CYC}"            >CONTROL 
  echo "2"                                  >>CONTROL
  echo "${DAT}"                             >>CONTROL
  echo "file1.${PDY-1}${CYC}"               >>CONTROL
echo "${DAT}"                             >>CONTROL
  echo "file1.${PDY}${CYC}"               >>CONTROL
echo "${DAT}"                             >>CONTROL
  echo "file1.${PDY+1}${CYC}"               >>CONTROL
  
# append the second part of the control file
  cat ${FIXuser}/special_control            >>CONTROL

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display dates between two dates

Hi All, I have 2 dates in mm/dd format. sdate=10/01 (October 01) edate=10/10 (October 10) I need the dates in between these 2 dates like below. 10/01 10/02 10/03 10/04 10/05 10/06 10/07 10/08 (1 Reply)
Discussion started by: jayadanabalan
1 Replies

2. Shell Programming and Scripting

Need simple script to generate future dates

Hi All, I am looking into a script which will give me a future dates for 7 days, including next month dates in case if runs on month ends... I an able to get this in Linux but not working for Solaris. OS: Solaris 10 Please help (6 Replies)
Discussion started by: nanz143
6 Replies

3. UNIX for Advanced & Expert Users

How to get the Missing dates between two dates in the table?

Hi Am Using Unix Ksh ... I have a Table called date select * from date ; Date 01/02/2013 06/02/2013 I need the output as Missing Date 01/02/2013 02/02/2013 03/02/2013 04/02/2013 05/02/2013 06/02/2013 (2 Replies)
Discussion started by: Venkatesh1
2 Replies

4. Shell Programming and Scripting

Generating dates between two dates

HI, i have row like this HHH100037440313438961000201001012012073110220002 N in this i have 2 dates in pos 25-32 and 33-40 , so based upon the se two dates , i need to generated records between these two values so in the above record 20100101 and 20120731 need to genearte rows like this... (4 Replies)
Discussion started by: sathishsr
4 Replies

5. UNIX for Dummies Questions & Answers

How to write the dates between 2 dates into a file

Hi All, I am trying to print the dates that falls between 2 date variables into a file. Here is the example. $BUS_DATE =20120616 $SUB_DATE=20120613 Output to file abc.txt should be : 20120613,20120614,120120615,20120616 Can you pls help me accomplish this in LINUX. Thanks... (5 Replies)
Discussion started by: dsfreddie
5 Replies

6. Emergency UNIX and Linux Support

Replacing dates]] with (dates)]]

Hi guys, For my wiki site I need to fix 1400 pages that use the wrong date format, most pages (not all) use eg. 1988]] I need to change that to (1988)]] The date range goes back to 1400 so I guess I need to do the following ssh into my server, dump mysql database vi .sql dump search... (20 Replies)
Discussion started by: lawstudent
20 Replies

7. Programming

SQL: find if a set od dates falls in another set of dates

Don't know if it is important: Debian Linux / MySQL 5.1 I have a table: media_id int(8) group_id int(8) type_id int(8) expiration date start date cust_id int(8) num_runs int(8) preferred_time int(8) edit_date timestamp ON UPDATE CURRENT_TIMESTAMP id... (0 Replies)
Discussion started by: vertical98
0 Replies

8. Shell Programming and Scripting

Need script to generate all the dates in DDMMYY format between 2 dates

Hello friends, I am looking for a script or method that can display all the dates between any 2 given dates. Input: Date 1 290109 Date 2 010209 Output: 300109 310109 Please help me. Thanks. :):confused: (2 Replies)
Discussion started by: frozensmilz
2 Replies

9. Shell Programming and Scripting

To get previous or future dates based on input value

Hi, I need something like, if the input date is 24/Aug/2008 and the inputvalue is +8 then the result should be 1/Sep/2008 (8 days after the input date) if the input date is 24/Aug/2008 and the inputvalue is -8 then the result should be 16/Aug/2008 (8 days before the input date) is there any... (5 Replies)
Discussion started by: Sharmila_P
5 Replies

10. Shell Programming and Scripting

Checking for future / non existent dates

'm attempting to script an application for the bash shell. The application needs to check for birthday, but must check the birthday to see if the date is a) in the future b) exists at all (ie Feb 29th during non-leap years). The input is being entered in a YYYYMMDD format, so I was hoping someone... (2 Replies)
Discussion started by: DKNUCKLES
2 Replies
Login or Register to Ask a Question