Date Scripting Question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Date Scripting Question
# 1  
Old 10-19-2006
Date Scripting Question

I am trying to append a portion of a file with a date on it that changes daily to a temp file. Here are my commands:

set DATE = ('date +%Y%m%d_sum.log')

cat $HOME/right/$DATE > /export/home/temp.txt

Here is the error I keep receiving:

cat: cannot open /temp/usr/nedaniel/right/date
cat: cannot open +%Y%m%d_sum.log
No match

Can someone answer why the whole cat command is not being read and what I need to do to fix it?

Thanks. Smilie
# 2  
Old 10-19-2006
Code:
DATE=`date +%Y%m%d`"_sum.log"

# 3  
Old 10-19-2006
I'm still receiving the same error.
# 4  
Old 10-19-2006
can you show the trace of the script?
# 5  
Old 10-19-2006
Here is the whole script:

#!/bin/csh

rm /export/home/temp.txt

set DATE = 'date +%Y%m%'''d_sum.log'

cat $HOME/right/$DATE > /export/home/temp.txt

mailx -s "Job Sum <Log>" xxxxxx@xxxxxx.com < /export/home/temp.txt

I don't have any kind of trace. That is the whole script with this error:

cat: cannot open /temp/usr/nedaniel/right/date
cat: cannot open +%Y%m%d_sum.log
No match
# 6  
Old 10-19-2006
set DATE = `date +%Y%m%d`"_sum.log"

Use backticks instead single quotes
# 7  
Old 10-19-2006
Thanks for your help!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Scripting with date format conversion

I have a script below and wanted to change the output into three different file format (3 separate script) #!bin/bash #input file format postwrf_d01_20131206_0600_f08400.grb2 #postwrf_d01_YYYYMMDD_ZZZZ_f0HHHH.grb2 #zzzz= 0000,0600,1200,1800 (in UTC) #HHHH=00000,00600,01200,01800 ..ect (in... (1 Reply)
Discussion started by: cumulus_255
1 Replies

2. Shell Programming and Scripting

Shell Scripting Date manipulation

Hi Experts, i have date as inputdate=01/01/2013,how to get the previous date from this date and also first day's date of the month. example: inputdate=01/06/2013 previousdate=31/05/2013 firstdate=01/05/2013 how can i get solution to this. my unix is not supporting GNU Dates ... (0 Replies)
Discussion started by: learner24
0 Replies

3. Shell Programming and Scripting

need help scripting a date when the date is 1st to 9th

I'm new to scripting, I am trying to get the current month and date in my script I have this line MYDATE=`date '+%b %d'` this works for dates 10-31, but it returns a 09 for the 9th, where the file name has a 9, I tried MYDATE=`date '+%b %_d'` but that returns Jul %_d I... (5 Replies)
Discussion started by: rsurwill
5 Replies

4. AIX

Scripting AIX date output !!

Hi, I am writing a korn shell script in AIX. I want to pass the date as a parameter to script and inside it should convert the format to +%a" "%h" "%d" "%Y. For e.g., a parameter passed as "20100301" should be converted to "Mon Mar 01 2010". I can easily do this with AIX "date" option for... (2 Replies)
Discussion started by: shibajighosh
2 Replies

5. Shell Programming and Scripting

ksh scripting ... get previous date

hi all, i am developing a korn shell script. One of the requirement is to generate the date, which is 7 days before the current date, and create a folder with that date. So for ex: if the time command returns 13 Feb 2009, I should be able to generate 6 Feb 2009, and assign that to a variable. ... (4 Replies)
Discussion started by: allah_waris45
4 Replies

6. Shell Programming and Scripting

Scripting question

Folks; I'm writing a shell script to extract some fields out of a log file & it will run periodically, how can i make it runs starting from where it left of. for example; if the script will do the extract every 2 days, let's say the first run will extract fields until July 25, 2007 @ 11:15:22... (1 Reply)
Discussion started by: moe2266
1 Replies

7. Solaris

Scripting question

I'm writing a small script that will run an executable program (sort of like TOP). To exit the executable, you have to enter control C (^c). I'm trying to use a redirect input file to send the ^c but I'm not having any luck. My short script looks like this - /mydirectory/abc.script < abc.in >... (1 Reply)
Discussion started by: gonzotonka
1 Replies

8. Shell Programming and Scripting

scripting question

i have to use bash to get system information like IP address and the operating system being used, does anybody know how to do this? (10 Replies)
Discussion started by: carlvernon
10 Replies

9. Shell Programming and Scripting

Date format - Shell scripting gurus please help

Guys: I have the following script (from this forum) to calculate yesterdays date. However the format of the date that is output is yyyymd if the resultant date is single digit or the resultant month is a single digit month ( 01 - 09 ). How can I get the output to show the date in the following... (3 Replies)
Discussion started by: geomonap
3 Replies

10. Shell Programming and Scripting

scripting question

I'm new to shell scripting and am having a problem trying to do something in C shell. I want to write a script that will input something instead of a user doing it. For example, using the command 'write' the user is supposed to type something to be sent to another user. I want a script to be able... (3 Replies)
Discussion started by: batmike
3 Replies
Login or Register to Ask a Question