when i run the shell script it has to check the current date and compare it with the todays date and give me the value which is one day less than that of todays date ..
when i execute DATE command it gives me this
Fri Mar 21 02:04:21 GMT 2008
so output should be 2008-05-20 , is there are no values then echo " no values present "
This is just to find what are all old in my unix box .. This is used in my routine work
What do you think is the difference between Current date & Today's date?
And what are you trying to do with your input file?
Can you pls explain your problem clearly? Try and paste a bit code you've tried to develop so far..it will fetch you better & quicker replies.
Good luck!
Sorry .. i was not clear , these values are present in a file .. and i have to compare it with current date in unix box and give a result which is one day
more , and if there are no entries in the input file then result " NO values are present"
i need to chk the current date (systemdate) and compare it with a.txt if the expiring dates are with the range of 30 days it should print the line , else ignore the line and echo " no Keys are in expiring state"
I know that we can proceed on if conditons , but not sure of the date conversion .. Thanks for all your help !!
but it giving sed command grabled .. can you please take a look of the below error !! Thanks again
date: illegal option -- -
date: illegal option -- t
date: illegal option -- c
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[3]: =: not found
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[4]: =: not found
[expires: 2008-03-29]
sed: command garbled: s/^.: \(.\)$/\1
cc.sh[2]: =: not found
date: illegal option -- -
date: illegal option -- t
date: illegal option -- c
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[3]: =: not found
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[4]: =: not found
[expires: 2008-04-26]
sed: command garbled: s/^.: \(.\)$/\1
cc.sh[2]: =: not found
date: illegal option -- -
date: illegal option -- t
date: illegal option -- c
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[3]: =: not found
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[4]: =: not found
[expires: 2008-05-26]
sed: command garbled: s/^.: \(.\)$/\1
cc.sh[2]: =: not found
date: illegal option -- -
date: illegal option -- t
date: illegal option -- c
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[3]: =: not found
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[4]: =: not found
[expires: 2008-06-26]
sed: command garbled: s/^.: \(.\)$/\1
cc.sh[2]: =: not found
date: illegal option -- -
date: illegal option -- t
date: illegal option -- c
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[3]: =: not found
date: illegal option -- -
date: illegal option -- d
date: invalid argument -- te
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
cc.sh[4]: =: not found
[expires: 2008-07-26]
Hmm, which unix are you using. I came at this from a Linux perspective with GNU Date. If you don't have GNU date then some of those commands will def. fail. Also, as I said, it was off the top of my head, so the sed command regex will probably need some work.
Have to go eat with the inlaws now, so will look at this again tonight if you haven't solved it by then.
Things that might be pertinent:
what unix? (hpux, solaris, tru64 etc)
what version of unix?
do you have access to gnu date?
which shell? (bash, korn etc)
Hi .. i tried using this .. but couldnot analyze th code .. it gives an error ..
syntax error at -e line 9, near "print
"
Semicolon seems to be missing at -e line 10.
syntax error at -e line 11, near ")
a"
Execution of -e aborted due to compilation errors.
The above problem has been solved .. once the Program finds that there is no values found .. it has to exit out from the shell and send an email alert As No key values found .. else it proceeds with the rest of the steps !!!