Sponsored Content
Full Discussion: Naming number to months
Top Forums Shell Programming and Scripting Naming number to months Post 302882307 by mahesh shinde on Monday 6th of January 2014 05:39:09 AM
Old 01-06-2014
Hi,

For example, I have 24 files corresponding to JAN to DEC 2001 and JAN to DEC 2002.

the files are avg_1.nc avg_2, ....... avg_24.nc.

I want to rename it as

avg_jan_2001, avg_feb_2001,...........,avg_dec_2002.nc

I am trying it for first year as...
Code:
#!/bin/sh

year_st=2001
year_en=2001
year=$year_st
while [ $year -le $year_en ]
do
 for var in jan feb mar apr may jun jul aug sep oct nov dec
   do
      echo $var_$year
     
   done
     year = $(( year_st+1 ))
 done

But it gives me only 2001 without end.

can anybody modify this script for two years ?

thanks

Last edited by Franklin52; 01-06-2014 at 07:33 AM.. Reason: Please use code tags
 

9 More Discussions You Might Find Interesting

1. 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

2. UNIX for Advanced & Expert Users

Controller Naming

Hello all, How does the Solaris identifies the controller subscript ? ( like c0txdxs0 or c1txdxsx ?? ) I have a unix box ( Ultra 30) running with 2.5.1. When I connected an external hard disk to the on-board scsi port, it got identified as c0t1dxsx... (... (1 Reply)
Discussion started by: shibz
1 Replies

3. 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

4. Shell Programming and Scripting

some months ego

Hi, how can I format date function to find n (n=1 to 11) months ego ? For exemple now we are in july and I want to have a variable presenting april. How should it be : month=`date +%b`????? Many thanks before. (8 Replies)
Discussion started by: big123456
8 Replies

5. Shell Programming and Scripting

#file naming

hi all, Please advise at what circumstance those file will become -rwxr-xr-x 1 psa psa 1969088 Aug 18 2006 #libaa.sl -rwx------ 1 psa psa 2166784 Jul 25 2006 #libcrypto.sl.0.9.7 -rwx------ 1 psa psa 904040 Jul 25 2006 #libxxx.sl -rwx------ 1 psa ... (2 Replies)
Discussion started by: rauphelhunter
2 Replies

6. Shell Programming and Scripting

naming columns

i have a file staff.txt with contents tom|25|New York sims|40|London neyo|18|Moscow i want to label the column at the top, my output should be Names|age|city of birth tom|25|New York sims|40|London neyo|18|Moscow (4 Replies)
Discussion started by: blackzinga80
4 Replies

7. Shell Programming and Scripting

Count number of errors within logs for last 6 months

I have directory /test/logs which has multiple logs: audit.log audit.log.1 audit.log.2 audit.log.3 audit.log.4 audit.log.5 audit.log is current log file and audit.log.X are archive log files. I need to search within these log files and count word "error-5" logged within last 6 months... (4 Replies)
Discussion started by: djanu
4 Replies

8. What is on Your Mind?

Humorous naming

Dear all, We've been asked to submit names for our documentation system. It used to be the very dry ISDL (Information Services Documentation Library) The replacement is built on a Wiki-beastie but that doesn't help much with a name. I wondered about an acronym based on CRAFT, so I can... (1 Reply)
Discussion started by: rbatte1
1 Replies

9. Shell Programming and Scripting

Help with naming the file

Hi, I have a folder that contains files abc.txt def.txt ....and so on Inside abc.txt, I have @<TRIPOS>MOLECULE 4|Chelerythrine|abcb11_earlyIdentification_Stronginhib_washed_ligprep|sdf|1|dock Inside def.txt, I have @<TRIPOS>MOLECULE... (6 Replies)
Discussion started by: rossi
6 Replies
DateTime::Locale::ia(3) 				User Contributed Perl Documentation				   DateTime::Locale::ia(3)

NAME
DateTime::Locale::ia SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'ia' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Interlingua. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) lunedi martedi mercuridi jovedi venerdi sabbato dominica Abbreviated (format) lun mar mer jov ven sab dom Narrow (format) 2 3 4 5 6 7 1 Wide (stand-alone) lunedi martedi mercuridi jovedi venerdi sabbato dominica Abbreviated (stand-alone) lun mar mer jov ven sab dom Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) januario februario martio april maio junio julio augusto septembre octobre novembre decembre Abbreviated (format) jan feb mar apr mai jun jul aug sep oct nov dec Narrow (format) 1 2 3 4 5 6 7 8 9 10 11 12 Wide (stand-alone) januario februario martio april maio junio julio augusto septembre octobre novembre decembre Abbreviated (stand-alone) jan feb mar apr mai jun jul aug sep oct nov dec Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Quarters Wide (format) 1-me trimestre 2-nde trimestre 3-tie trimestre 4-te trimestre Abbreviated (format) T1 T2 T3 T4 Narrow (format) 1 2 3 4 Wide (stand-alone) 1-me trimestre 2-nde trimestre 3-tie trimestre 4-te trimestre Abbreviated (stand-alone) T1 T2 T3 T4 Narrow (stand-alone) 1 2 3 4 Eras Wide ante Christo post Christo Abbreviated a.Chr. p.Chr. Narrow a.Chr. p.Chr. Date Formats Full 2008-02-05T18:30:30 = martedi, 2008 februario 05 1995-12-22T09:05:02 = venerdi, 1995 decembre 22 -0010-09-15T04:44:23 = sabbato, -10 septembre 15 Long 2008-02-05T18:30:30 = 2008 februario 5 1995-12-22T09:05:02 = 1995 decembre 22 -0010-09-15T04:44:23 = -10 septembre 15 Medium 2008-02-05T18:30:30 = 2008 feb 5 1995-12-22T09:05:02 = 1995 dec 22 -0010-09-15T04:44:23 = -10 sep 15 Short 2008-02-05T18:30:30 = 08/02/05 1995-12-22T09:05:02 = 95/12/22 -0010-09-15T04:44:23 = -10/09/15 Default 2008-02-05T18:30:30 = 2008 feb 5 1995-12-22T09:05:02 = 1995 dec 22 -0010-09-15T04:44:23 = -10 sep 15 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = martedi, 2008 februario 05 18:30:30 UTC 1995-12-22T09:05:02 = venerdi, 1995 decembre 22 09:05:02 UTC -0010-09-15T04:44:23 = sabbato, -10 septembre 15 04:44:23 UTC Long 2008-02-05T18:30:30 = 2008 februario 5 18:30:30 UTC 1995-12-22T09:05:02 = 1995 decembre 22 09:05:02 UTC -0010-09-15T04:44:23 = -10 septembre 15 04:44:23 UTC Medium 2008-02-05T18:30:30 = 2008 feb 5 18:30:30 1995-12-22T09:05:02 = 1995 dec 22 09:05:02 -0010-09-15T04:44:23 = -10 sep 15 04:44:23 Short 2008-02-05T18:30:30 = 08/02/05 18:30 1995-12-22T09:05:02 = 95/12/22 09:05 -0010-09-15T04:44:23 = -10/09/15 04:44 Default 2008-02-05T18:30:30 = 2008 feb 5 18:30:30 1995-12-22T09:05:02 = 1995 dec 22 09:05:02 -0010-09-15T04:44:23 = -10 sep 15 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 mar 1995-12-22T09:05:02 = 22 ven -0010-09-15T04:44:23 = 15 sab Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 p.m. 1995-12-22T09:05:02 = 9:05 a.m. -0010-09-15T04:44:23 = 4:44 a.m. Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 p.m. 1995-12-22T09:05:02 = 9:05:02 a.m. -0010-09-15T04:44:23 = 4:44:23 a.m. M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = mar, 2-5 1995-12-22T09:05:02 = ven, 12-22 -0010-09-15T04:44:23 = sab, 9-15 MMM (LLL) 2008-02-05T18:30:30 = feb 1995-12-22T09:05:02 = dec -0010-09-15T04:44:23 = sep MMMd (MMM d) 2008-02-05T18:30:30 = feb 5 1995-12-22T09:05:02 = dec 22 -0010-09-15T04:44:23 = sep 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = mar feb 5 1995-12-22T09:05:02 = ven dec 22 -0010-09-15T04:44:23 = sab sep 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = februario 5 1995-12-22T09:05:02 = decembre 22 -0010-09-15T04:44:23 = septembre 15 MMMMEd (E MMMM d) 2008-02-05T18:30:30 = mar februario 5 1995-12-22T09:05:02 = ven decembre 22 -0010-09-15T04:44:23 = sab septembre 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = mar, 2008-2-5 1995-12-22T09:05:02 = ven, 1995-12-22 -0010-09-15T04:44:23 = sab, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 feb 1995-12-22T09:05:02 = 1995 dec -0010-09-15T04:44:23 = -10 sep yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = mar, 2008 feb 5 1995-12-22T09:05:02 = ven, 1995 dec 22 -0010-09-15T04:44:23 = sab, -10 sep 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 februario 1995-12-22T09:05:02 = 1995 decembre -0010-09-15T04:44:23 = -10 septembre yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 T1 1995-12-22T09:05:02 = 1995 T4 -0010-09-15T04:44:23 = -10 T3 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week lunedi SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::ia(3)
All times are GMT -4. The time now is 10:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy