Problem in making shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in making shell script
# 1  
Old 02-08-2008
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  
Old 02-08-2008
Just because you are new does not preclude you from attempting to write a script. What have you attempted so far?
# 3  
Old 02-08-2008
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  
Old 02-08-2008
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  
Old 02-08-2008
thanks a tone

regards
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem in making a list with awk

Hi bodies,I am doing a list from a .txt file with awk commands but something is wrong. The .txt file looks like: 32782 28 18 32783 02 18 32784 01 18 32785 29 18 32786 25 23 32787 25 18 32788 00 18 32789 25 26 32790 02 23 32791 29 26 ... (2 Replies)
Discussion started by: Behrouzx77
2 Replies

2. Shell Programming and Scripting

shell script with decision making

Hi all I need help for the issue below. I need to create script: FORM_cmd=query || import FORM_command=add FORM_msisdn=389881234567 FORM_provcode=SK FORM_attr=12 FORM_cmd can be "query" or "import" when FORM_cmd="query" then execute -> spdci -cmd $FORM_cmd FORM_cmd when... (3 Replies)
Discussion started by: vasil
3 Replies

3. Shell Programming and Scripting

Making file inside shell script

Hi, i have written a shell script and its working fine till now. Now, i have to enhance it with a small updation. i need to make a file inside my file that will contain the below parameters 1) Customer_id 2) Server_id 3) No. Account All the above variables are already been taken in... (3 Replies)
Discussion started by: dazdseg
3 Replies

4. Shell Programming and Scripting

problem in making Awk executable script

Guys I placed #!path/awk -f placed awk script and used $1 to call 1st inputfile inside the script. But some where I did mistake. Could you please help me run this script as executable I forgot to mention I also used BEGIN before placing awk script. But nothing worked out. Script ... (2 Replies)
Discussion started by: repinementer
2 Replies

5. Shell Programming and Scripting

Problem in making itration

Hi, I have a file which keeps on appending the data continuously, i that i am looking for a particular pattern, if i dont find that pattern i want to wait for 30 seconds to check it again. can we use it like this ----------------------------- until do cat $line |... (1 Reply)
Discussion started by: Prateek007
1 Replies

6. Shell Programming and Scripting

[problem] making a backup files

Hi guys, I'm a little stuck on this problem, I've tried googling it and some trial and error but can't seem to get it working. Basically I need the script to: 1) create a directory called "mybackups", if it doesn't exist 2) go through all the .sh files in the current directory, and copy... (4 Replies)
Discussion started by: chazij
4 Replies

7. Shell Programming and Scripting

problem in making sftp script

Dear all I am bit new to shell scripting . I am implemented autossh between two sun solaris machines , so that when I use sftp it will not ask for the password. Now I need to make shell script in which I have to transfer files from one server to another server automatically through root... (8 Replies)
Discussion started by: girish.batra
8 Replies

8. Shell Programming and Scripting

making shell script

Hi , I am new to shell scripting I want to make script as to execute followng command mysqldump -u (user name) -p(password) database name>filename.sql this file saves with current date and time and execute automatically at particular time which I give (10 Replies)
Discussion started by: kaushik02018
10 Replies

9. Programming

DDD making problem

Hi Everybody, I am trying to make the ddd-3.3.9 debugger. I installed all dependencies. this is what i get: # make Making all in themes make: Entering directory `/space/atoulan/ddd-3.3.9/themes' make: Nothing to be done for `all'. make: Leaving directory... (0 Replies)
Discussion started by: azazel11998
0 Replies
Login or Register to Ask a Question