12-12-2001
Solved ...
Try the following ...
## Long Name Month Listing.
lngmth="January February March April May June \
July August September October November December"
## Short Name Month Listing.
shtmth="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
##
## Get Current Month Number (01-12).
xcurmth=`date +%m`
## Get Previous Month Number (01-11).
xprvmth=`expr $xcurmth - 1`
## Get Year Number (??).
xcuryr=`date +%Y`
## Get Previous Year Number (??).
xprvyr=`expr $xcuryr - 1`
xx=`echo $shtmth | cut -f$2 -d" "`
zz=`echo $lngmth | cut -f$2 -d" "`
XX=`echo $shtmth | cut -f$2 -d" "`$xprvyr
ZZ=`echo $lngmth | cut -f$2 -d" "`$xcuryr
If $xprvmth = 0 then you must use $xprvyr and 12 for the month. ...
(eg.
`echo $shtmth | cut -f12 -d" "`$xprvyr)
8 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
Can I back up all the files I work with each day using tar? (2 Replies)
Discussion started by: jo calamine
2 Replies
2. Shell Programming and Scripting
Hi Guys,
My unix is SunOS. I like to find all the files which are created 1 day back.
i tried the following command
find . -type f -name '*.aud' -mtime +1
This gives me all the files created 48 hours back (2 days) but not one..
Can you let me know where i am going wrong.
Thanks,... (8 Replies)
Discussion started by: mac4rfree
8 Replies
3. Shell Programming and Scripting
Hi,
does anybody know how to format `date` command correctly to return the day of the week? Thanks -A
I work in ksh.... (1 Reply)
Discussion started by: aoussenko
1 Replies
4. Shell Programming and Scripting
Hi guys,
I had a scenario...
1. I had to get the previous days date in yyyymmdd format
2. i had to create a file with Date inthe format yyyymmdd.txt format
both are different
thanks guys in advance.. (4 Replies)
Discussion started by: apple2685
4 Replies
5. Shell Programming and Scripting
$beginDate = substr(DateCalc("today", "-7Days"),0,8);
This fetches the date 7 days back
Can I fetch the date before 7 years from todays date in Perl using same syntax
Use code tags, see PM. (3 Replies)
Discussion started by: parthmittal2007
3 Replies
6. AIX
I need to get the next day's date of the user entered date
for example:
Enter date (yyyy/mm/yy):
2013/10/08I need to get the next day's date of the user entered date
Desired Output:
2013/10/09Though there are ways to achieve this is Linux or Unix environment (date command) ,I need to... (1 Reply)
Discussion started by: rpm120
1 Replies
7. UNIX for Dummies Questions & Answers
Legends,
i need to get previous day using date command.
Can you please help.
sdosanjh:/home> date +%m%d%y
011514
i tried -d '-1 day' but it is not working (5 Replies)
Discussion started by: sdosanjh
5 Replies
8. UNIX for Beginners Questions & Answers
I Have text like
XXX_20190908.csv.gz need to replace Only date in this format with current date every day
Thanks! (1 Reply)
Discussion started by: yamasani1991
1 Replies