While read loop and rsh


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users While read loop and rsh
# 1  
Old 01-15-2006
While read loop and rsh

Hi all

I have a while read loop that I use to process a file line by line. The reason I am using this is due the fact that I have spaces in the line and a for loop treats the space as a delimeter for the next record.
In this while loop I have a rsh. It appears that cos of the rsh, I never get to the next record in the file as when I comment this out it reads all the records in infile.

while read LINE
do
rsh host "cat $LINE |cut -f 1 -d \" \""
done < infile

Any ideas ?

Thank you

J
# 2  
Old 01-15-2006
Use:
rsh -n
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsh reboot in a loop?

Hi folks. I'm trying to get the following script working for rebooting a bunch of clients. Up to now I've been using PSSH, but when they all startup again at the same time I get a few mount problems. So, I'm trying to stagger the reboot command. I know reboot will depend on what's running at... (3 Replies)
Discussion started by: MuntyScrunt
3 Replies

2. UNIX for Dummies Questions & Answers

Read statement within while read loop

hi, this is my script #!/bin/ksh cat temp_file.dat | while read line do read test if ]; then break else echo "ERROR" fi done when i execute this code , the script does wait for the user input . it directly prints "ERROR" and terminates after the no. of times as there... (3 Replies)
Discussion started by: siva1612
3 Replies

3. Shell Programming and Scripting

awk, double variable, for loop and rsh

Hello folks, I've a (perhaps) simple question. In a text file I've : server_name1: directory1 server_name2: directory2 server_name3: directory3 I want to make a loop that lets me connect and operate on every server: rsh server_name1 "ls -l directory1" I've tried with awk,... (6 Replies)
Discussion started by: gogol_bordello
6 Replies

4. Shell Programming and Scripting

until loop and read

Hi guys what I wanna do is to create a script where can I input several times a file - assume with read function that will be inserted into a temp. file for further processing. When I press q I want that the loop will stop and continue in my script I typed this but the options q is not working... (6 Replies)
Discussion started by: kl1ngac1k
6 Replies

5. Shell Programming and Scripting

Need help with for loop with while read

Hello, The code below pulls printer information from a three-column file (set by the ${MULTIFILE} variable at the end), that has the printer queue name, IP, and type of printer. It is supposed to use this info to add the printers in the list to one, or more servers . The input file... (3 Replies)
Discussion started by: LinuxRacr
3 Replies

6. Shell Programming and Scripting

rsh script with inside a for loop

hi everyone, I have the following problem: the foreach loop inside rsh doesn'work. I have tried the for command but it's not recognized. with the foreach command I don't receive any error, but it doesn't really make the cycle, ignoring the foreach and executing 1 time the echo command. Anyone has... (5 Replies)
Discussion started by: trekianov
5 Replies

7. Shell Programming and Scripting

Need Help : while read loop

hi all, Can you please help me with this issue ? while ####infinite loop do cat file1 |while read var1 var2 do func1 $var1 $var2 done cat file2 | while read var11 var22 do func2 $var11 $var22 done done func1 is called till all the values are read... (2 Replies)
Discussion started by: Navatha
2 Replies

8. Shell Programming and Scripting

rsh breaking me out of loop

Hey all I have two scripts, one script containing the guts of my code. The other simply loops through a list, calling the other script on each iteration. Problem is when I add the line `/usr/bin/rsh -l root $HOSTNAME ""` to my main script, the loop never seems to exectute any more... (1 Reply)
Discussion started by: mark007
1 Replies

9. Shell Programming and Scripting

rsh and for loop

hi I wanted to use the for loop structure in tandem with rsh command and the result to be redirected into a local .lst file within a shell script . Tried the following but does not help :confused: . rsh ABCD "cd /bosp/local/home/linus/;for i in `ls -ltr | grep ^- | awk {'print $9'}` do... (4 Replies)
Discussion started by: newbee2005
4 Replies

10. Shell Programming and Scripting

rsh command in a while loop

Hi , reading a "file1" with 2 data in each line (VAR1 and VAR2) , i'm using a while loop like this : cat file1|awk '{print $1,$2}'|while read VAR1 VA2 do echo $VAR1 echo $VAR2 done as this example shows , it works but if between do and done i use a "rsh" command , the script reads... (6 Replies)
Discussion started by: Nicol
6 Replies
Login or Register to Ask a Question