Read through a file and Pass system commands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read through a file and Pass system commands
# 1  
Old 03-27-2006
Read through a file and Pass system commands

Hi,

I have a file xyz.txt, which contains several "tar.gz" package names

Eg :-
Quote:
p2tr4.1.0.0.1.tar.gz
p2tr4.1.0.0.1.tar.gz
p2tr4.1.0.0.1.tar.gz
p2tr4.1.2.3.10.tar.gz
p2tr4.1.2.3.10.tar.gz
Now i need to execute an rpm - ivh against all those packages in this file through a script one by one.

I need a script to read through the file "xyz.txt", pick up each package name and execute rpm -ivh <package name> against each one by one.

any leads how this can be done ?

Thanks
# 2  
Old 03-27-2006
cat xyz.txt|while read line
do
rpm -ivh $line
done

Gaurav
# 3  
Old 03-27-2006
Quote:
Originally Posted by gauravgoel
cat xyz.txt|while read line
do
rpm -ivh $line
done

Gaurav
That cat is a UUOC.

Code:
while read line
do
rpm -ivh $line
done < xyz.txt

# 4  
Old 03-27-2006
hi vino,

can you please tell me what is UUOC

Regards,
Gaurav
# 5  
Old 03-27-2006
Thanks for that gaurav Smilie...
# 6  
Old 03-27-2006
See this - UUOC
# 7  
Old 03-27-2006
Thanks a lot vino,

systemali use the code given by vino as it is more elegant and optimized

Gaurav
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read file lines and pass line values as arguments.

Dears, Need help to implement below requirement A file (detail.txt)contain : 1st column: Stream 2nd column: PathAddress 3rd column: Counterlimit 4th column: TransactionDateColumn 5th column: DateType 6th column: SleepValue 7th column: Status Need to write a... (1 Reply)
Discussion started by: sadique.manzar
1 Replies

2. Shell Programming and Scripting

Login to remote machine pass commands and capture all in a file

Dear user/friends, After a long gap of 6 years i am back to this forum to find a solution and i hope i will get a solution or atleast a workaround for the problem:p Following is my task which i am trying for almost 3 days without any success. 1) run this command from my terminal (note i... (7 Replies)
Discussion started by: imas
7 Replies

3. Shell Programming and Scripting

Read input from file and pass it to sub shell

i have a scenario where in i have to monitor jobs which run in different servers, The job details(job name, host server, etc) are present in a dat file. I have written a script a script which reads the details from the dat file and calls a local method where the job monitoring logic is present.... (2 Replies)
Discussion started by: abubucker0
2 Replies

4. Shell Programming and Scripting

How to execute commands read from another file?

Please help with this simple example. I can not figure out how to do it. A file named “job” contains only this one line:var=5I need a script to read the job file and execute it as a command. This is my attempt (it does not work):#!/bin/sh exec < job echo "var = $var"output should read “var = 5”... (5 Replies)
Discussion started by: wolfv
5 Replies

5. SCO

file system not getting mounted in read write mode after system power failure

After System power get failed File system is not getting mounted in read- write mode (1 Reply)
Discussion started by: gtkpmbpl
1 Replies

6. Shell Programming and Scripting

Piping through commands read as variables from file

This is going to be part of a longer script with more features, but I have boiled it down to the one thing that is presently stumping me. The goal is a script which checks for updates to web pages that can be run as a cron job. The script reads (from a tab-delim file) a URL, an MD5 digest, and an... (1 Reply)
Discussion started by: fitzwilliam
1 Replies

7. Shell Programming and Scripting

Read Oracle Username password SID from single file and pass it to shell

Dear All I am trying to write one shell which will be running through Cron which contain one SQL query. But I want to draw/fetch the Username password and Instance name (required to loging to the database) from one single file to run that SQL query . Also this file contain details of multiple... (2 Replies)
Discussion started by: jhon
2 Replies

8. Shell Programming and Scripting

how to read a value from a file and pass it to a variable

Hi, Some one please help me with this script. I have a file "sequence.txt" and contents of it look like below. 1 5 3 7 4 7 5 74 from my script i should be able to read every single and save the first columnbs to variable x1, x2, x3 and second column as y1, y2, y3 and so on. Then i can... (3 Replies)
Discussion started by: pragash_ms
3 Replies

9. Shell Programming and Scripting

how do I pass or read values from file ?

Hi one & All , My Need is to Create 64 Partition and create File System in Linux. I have the Script ... for((a=0;a<=63;a++)) do fdisk /dev/cciss/c0d$a done for((a=0;a<=63;a++)) do mkfs.ext2 /dec/cciss/'c0d'$a'p1' done the moment I run the Script I get the Prompt ... Command... (1 Reply)
Discussion started by: nix-kid
1 Replies

10. Shell Programming and Scripting

read a file as input and pass each line to another script

Hi, I am trying to write a ftp script which will read a file for filenames and ftp those files to another server. Here's my ftp script, but it's scanning the current directory for file names. My question is how can I pass multiple files (these files will have the name of data files that need to... (0 Replies)
Discussion started by: sajjad02
0 Replies
Login or Register to Ask a Question