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
problem in making sftp script girish.batra Shell Programming and Scripting 8 01-07-2009 06:28 AM
problem while making ftp of a large file rprajendran UNIX for Dummies Questions & Answers 1 05-28-2008 01:19 AM
problem in making autossh between windows and solaris girish.batra UNIX for Advanced & Expert Users 7 04-10-2008 11:04 AM
problem in making file name from date command girish.batra Shell Programming and Scripting 2 02-13-2008 03:50 AM
DDD making problem azazel11998 High Level Programming 0 03-10-2005 07:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-08-2008
girish.batra girish.batra is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 73
Problem in making shell script

Dear all

Dear Brother
I am bit new to programming or shell scripting. I have given one shell script which is regarding combining all the 240 or less files in a particular folderwhich is related to one hour of the day. There will be 24 these kind of folders related to a day . It means there will 24 files will be created at the end of day after executation of this shell script which will be put in a specific folder named (/girish). For every folder there will be 240 or less files present in folder named like (/amit/01) for first hour of the day(0 – 1 am),(/amit/02) for the second hour of the day (1-2 am)…..so on. Like suppose at 1.05 am there will be 240 files or less present in a folder named ( /amit/01), we have to run a shell script which will combined all these file through cron job and send that file to (/girish) folder. This same procedure happen at 2.05am for folder(/amit/02), 3.05am for folder (/amit/03)……..so on till 24 files are created. All these 24 files should follow some naming convenction so that these file can easily be recogonizable which tells which file belong to which hour or folder. Please arrange this script so that I can put in a cron tab file.

Kind regards
  #2 (permalink)  
Old 02-08-2008
KevinADC KevinADC is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2008
Posts: 731
Just because you are new does not preclude you from attempting to write a script. What have you attempted so far?
  #3 (permalink)  
Old 02-08-2008
girish.batra girish.batra is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 73
Dear Sir

I have done bit of it , I am facing one problem regarding how will i set a loop in which i will use

cat filename>>tmp

tmp will be the file which will contain the output of all the files in a particular folder.

I already said that in a particular folder there will be 240 or less file present at a given hour and at a given day. If suppose there are 201 file are present in particular folder at a given day about which i don't know, then how will i run the loop 201 times and substitute the filename with a persent file name in that particuler folder

cat filename>>tmp



kind regards
  #4 (permalink)  
Old 02-08-2008
rvegmond rvegmond is offline
Registered User
  
 

Join Date: Feb 2008
Location: The Netherlands
Posts: 39
Do you mean something like:

for file in `ls PATH_NAME`
do
cat $file >> tmp
done

this will cat the contents of all the files in PATH_NAME to tmp (unsorted)
  #5 (permalink)  
Old 02-08-2008
girish.batra girish.batra is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 73
thanks a tone

regards
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 01:32 AM.


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