The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help needed please. jerryboy78 UNIX for Dummies Questions & Answers 3 03-16-2008 10:06 AM
help needed nnayagam Shell Programming and Scripting 2 03-07-2008 02:34 AM
Little help needed. Netghost AIX 5 08-10-2006 11:29 AM
awk help needed. cskumar Shell Programming and Scripting 0 07-20-2006 04:24 AM
Sed help needed stevefox Shell Programming and Scripting 5 12-04-2005 09:44 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-19-2006
Registered User
 

Join Date: Jul 2006
Posts: 180
Help needed

Hi All,

I need help in writing a script. I need a script that takes a name as a parameter and executes the follwoing steps.

The name will be like BUDGET01_BARE_DLY_YYYYMMDD, BUDGET02_BARE_DLY_YYYYMMDD etc. The YYYYMMDD represent today( systemdate). This names have to be passed as paramaters to the script and what it has to do is:

1. count the number of files for that name in the direcotry /opt/app ; for e.g for the file name BUDGET01_BARE_DLY_YYYYMMDD there will be 27 files with that name. if the number is less than 27 for BUDGET01_BARE_DLY_YYYYMMDD then through an error saying that not enough files for today. Then this has to happen to BUDGET02_BARE_DLY_YYYYMMDD similarly. If it has enough files then remove the last BARE_DLY_YYYYMMDD characters in the names. This has to occur recursively for different file names.

Any help will be greatly appreciated.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-19-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,323
I think you are a bit confused. For any given day, you can have only one file with the name BUDGET01_BARE_DLY_YYYYMMDD. For instance, for today 20 July 2006, the filename will be BUDGET01_BARE_DLY_20060720.

Do you mean that you will have filenames such as BUDGET01_BARE_DLY_YYYYMMDD, BUDGET02_BARE_DLY_YYYYMMDD, etc... upto BUDGET27_BARE_DLY_YYYYMMDD?
Reply With Quote
  #3 (permalink)  
Old 07-20-2006
Registered User
 

Join Date: Jul 2006
Posts: 180
I am sorry I was not clear in my post. When i said i will have 27 files with that name for that day means the file name will be like below. The MKT represents 27 cities and hence I will have 27 files per day. For e.g if AUStralia is the market i have BUDGET01_TLG_DLY_<AUS>_<YYYYMMDD>.dat. For India i have BUDGET01_TLG_DLY_<IND>_<YYYYMMDD>.dat. There will be 27 files from different countries. I think I am clear in what I want now. I need to pass BUDGET01_yyyymmdd as parameter and continue to check if there are 27 files with that name otherwise I have to thruogh an error. This has to be done for BUDGET2 files also. Please help.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0