read input file for batch job


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting read input file for batch job
# 1  
Old 02-16-2005
read input file for batch job

hi all,

I am a newbie in unix shell script. May I know how to write a bacth job to
read a list of files afrom the inout file and do the chmod ? Thanks.
i.e.
inside input.txt
====
a.txt
b.txt
c.txt

and I want to write a batch job to read the input .txt and do the chmod 755 for all 3 files in the input.txt

thx in advance!
# 2  
Old 02-16-2005
I don't understand - you stated in your other post about the exact same thing that you were going to use if statements - yet, you post the exact same question with no code. Either post the code you have been busy working on and questions about problems with it, or use the suggestions from the replies in your other post. Thanks.
# 3  
Old 02-16-2005
Hi kinmak,

If you want to grant full permissions mode to the files (777),your shell script should be as the following:

#! /bin/ksh
cat input.txt | while read line
do
chmod 777 $line >/dev/null 2>&1
done

Good luck!

Nir
# 4  
Old 02-16-2005
Quote:
Originally Posted by nir_s
Hi kinmak,

If you want to grant full permissions mode to the files (777),your shell script should be as the following:

#! /bin/ksh
cat input.txt | while read line
do
chmod 777 $line >/dev/null 2>&1
done

Good luck!

Nir
UUOC

Code:
while read line
do
  chmod 777 "${line}" >/dev/null 2>&1
done < input.txt


Last edited by Perderabo; 07-08-2007 at 04:38 PM.. Reason: Update UUOC URL
# 5  
Old 02-16-2005
kinmak, please read our rules and note in particular:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post where your goal is to get an answer more quickly.

I removed your duplicate post from that other thread.
# 6  
Old 02-16-2005
Bug

what about

Code:
chmod 777 `cat input.txt`

# 7  
Old 02-16-2005
Hi Vgersh99 ,
Thansk for yourr reply...
may I know what does this part of command mean >/dev/null 2>&1 ?

thx
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read input files and merge them in given order and write them to input one param or one file

Dear Friends, I am looking for a shell script to merge input files into one file .. here is my idea: 1st paramter would be outfile file (all input files content) read all input files and merge them to input param 1 ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies

2. Windows & DOS: Issues & Discussions

To run job in parallel in batch

Hi, I am using a batch file to run 2 or more shutdown batch for each of my server like below: Shutdown_serverA.bat Shutdown_serverB.bat ... Is there anyway i can do this in parallel instead of serially:confused: ServerA & ServerB shutdown at the same time in one click (batch). (4 Replies)
Discussion started by: beginningDBA
4 Replies

3. Solaris

Can a batch job truly have a PID of 1?

Is it possible for a process id of 1. Is there anything special about 1 or 8 ? (7 Replies)
Discussion started by: Harleyrci
7 Replies

4. Shell Programming and Scripting

Batch job in unix server to move the pdf file from unix to windows.

Hi Experts, I have a requirement where i need to setup a batch job which runs everymonth and move the pdf files from unix server to windows servers. Could some body provide the inputs for this. and also please provide the inputs on how to map the network dirve in the unix like that... (1 Reply)
Discussion started by: ger199901
1 Replies

5. UNIX for Dummies Questions & Answers

How to create a batch job ?

Hi In unix how to create a batch job and Is there any command to close file in unix. Please help me I am new to unix world (6 Replies)
Discussion started by: vinay.h4
6 Replies

6. UNIX for Dummies Questions & Answers

read input file

echo "enter employee #:/c" read employee grep -w $employee /tmp/file.txt when it asked me employee #, i typed employee, worked fine. when it asked me employee #, i type ENTER, it just sit there. if someone type in NULL or ENTER key, i want to exit out. (2 Replies)
Discussion started by: tjmannonline
2 Replies

7. Shell Programming and Scripting

A Batch job to delete files from various directories

Hi, I have a shell script to find files older than 'X' days ($2) in directory path ($1) and delete them. Like this: my_file_remover.sh /usr/home/c 90 Now, I need to modify this script and add it in CRON, so that it checks other directories also. Like: my_file_remover.sh /usr/home/c... (3 Replies)
Discussion started by: guruparan18
3 Replies

8. UNIX for Dummies Questions & Answers

Regarding interactive ID of batch job

Hi all, We are running a batch job using Unix script. This batch job is running daily to get data from a Mainframe database and to load our tables. We are using an interactive ID for the batch job. If we removed that interactive ID, the batch job fails. What's my question is.. Is the... (1 Reply)
Discussion started by: pradeep.edara
1 Replies

9. Windows & DOS: Issues & Discussions

windows scripting for a batch job

I have been doing unix scripting for quite awhile and there seems to be a wealth of information on it. Now I am working on migrating an intel based application to a new server. I need to modify some existing scripts, but am having trouble finding information on windows scripting, a forum similar... (2 Replies)
Discussion started by: MizzGail
2 Replies

10. Shell Programming and Scripting

Read the lines from the file in batch

Hi, I want to read lines in a loop. eg. In a file with 100 lines..first I want to read first 1 to 10 lines and redirect it to other file, then next 10 lines ( 11 to 20 ) and redirect it to the file ... .till end of file. I am not sure how to achieve this.Need help. (2 Replies)
Discussion started by: amitraorane
2 Replies
Login or Register to Ask a Question