The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 02:06 PM
help needed nnayagam Shell Programming and Scripting 2 03-07-2008 06:34 AM
Little help needed. Netghost AIX 5 08-10-2006 03:29 PM
awk help needed. cskumar Shell Programming and Scripting 0 07-20-2006 08:24 AM
Sed help needed stevefox Shell Programming and Scripting 5 12-05-2005 01:44 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-20-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
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.
  #2 (permalink)  
Old 07-20-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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?
  #3 (permalink)  
Old 07-20-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0