some months ego


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting some months ego
# 8  
Old 07-26-2005
Code:
#! /usr/bin/ksh

mo=Jul
yr=2005
wayback=7

mos="Jan Feb Mar Apr Jun Jul Aug Sep Oct Nov Dec"
nmo=${mos%$mo*}
((nmo=${#nmo}/4+1))

if (( $((nmo=nmo-wayback)) < 1)) ; then
        ((nmo=nmo+12))
        ((yr=yr-1))
fi

typeset -L$(((nmo-1)*4)) snap=$mos
typeset -R3 mo=$snap
echo $mo $yr
exit 0

# 9  
Old 07-27-2005
Many thanks to all.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Naming number to months

Hi, I have many files of monthly means from model simulation such as 1,2,3,4.....12, corresponding to jan, feb, mar,....., dec. e.g. avg_1.nc, avg_2.nc, ............., avg_12.nc. i want to write a shell script such that it should conveet number into months and year such as..... (4 Replies)
Discussion started by: mahesh shinde
4 Replies

2. Post Here to Contact Site Administrators and Moderators

All threads closed after 3 months

I routinely watch for threads that have been unanswered for some time. Recently a rule has been implemented to close threads older than 3 months, which is rather restrictive, because now the last few pages of the unanswered threads section cannot be replied upon, but more importantly eliminates the... (23 Replies)
Discussion started by: figaro
23 Replies

3. Shell Programming and Scripting

Delete 6 months old files

Hi, Iam trying to delete 6 months old files. Iam using the following script -ctime +190 -type f -exec echo rm {} \; Iam getting an error saying -ctime not found. (6 Replies)
Discussion started by: Sompalle Jalaja
6 Replies

4. Shell Programming and Scripting

calculate 13 months ago

hi, I have a big file that contains datas since 4 years ago. I need re-create this file but just lines that are 13 months ago from today. see what I have: ( I have a file.ksh that calls this file.scl ok !!) ======== file.scl ================ /STATISTICS=stderr /STABLE /NODUPLICATES... (4 Replies)
Discussion started by: andrea_mussap
4 Replies

5. Shell Programming and Scripting

calculate 13 months ago

hi, I have a big file that contains datas since 4 years ago. I need re-create this file but just lines that are 13 months ago from today. see what I have: ( I have a file.ksh that calls this file.scl ok !!) ======== file.scl ================ /STATISTICS=stderr /STABLE /NODUPLICATES... (3 Replies)
Discussion started by: andrea_mussap
3 Replies

6. UNIX for Advanced & Expert Users

Comparing two months

Hi all, Using shell script and awk statements, I manage to get the month and year of the Patch Bundle installed on the system. Now I have to compare month and year of Patch Bundle installed to the Patch Bundle which is desired on the workstation. I am able to do easily comparison of year but not... (1 Reply)
Discussion started by: pankschawla
1 Replies

7. IP Networking

DNS Help - Been trying to do this for months

Ok someone has to be able to help me here. I have the latest webmin, and i have bind i have a domain name called thedigitaldream.co.uk i have one server, just one as im poor so the one server is gunna be the dns, email, web and ftp server. Its only for a small site anyway so it will... (16 Replies)
Discussion started by: matt2kjones
16 Replies
Login or Register to Ask a Question