problem handling lov in FOR loop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem handling lov in FOR loop
# 8  
Old 06-19-2012
This is what i suggested:

Code:
while read line 
do
 column1=`echo $line|awk -F":" '{print $1}'`
 column2=`echo $line|awk -F":" '{print $2}'`
 echo "column1 = $column1"
 echo "column2 = $column2"
 
## After you get the values in two diff variables, use them to do whatever you want.

done < file.txt

# 9  
Old 06-19-2012
here is what I have so far.
Code:
 
FILE=/tmp/listsid.ls
exec 3<&0
exec 0<$FILE
while read line
do
     F1=awk -F":" '{print $1)'
     F2=awk -F":" '{print $2)'
     ssh $F1 bash <<EOF
     echo $F2
     EOF
done
/

Moderator's Comments:
Mod Comment Please use code tags, thanks!

Last edited by zaxxon; 06-19-2012 at 10:18 AM.. Reason: code tags, see PM
# 10  
Old 06-19-2012
There are problems with the basic syntaxes you have used. See my last post.
# 11  
Old 06-20-2012
Thanks for all the help.
i solved the problem with the following syntax.
Code:
FILE=/tmp/listsid.ls
while read line
do
F1=`echo $line|awk -F":" '{print $1}'`
F2=`echo $line|awk -F":" '{print $2}'`
ssh -q $F1 bash <<EOF >> /tmp/mailos.out
echo
echo " "
echo $F1 ":" $F2
echo


Last edited by Franklin52; 06-20-2012 at 07:55 AM.. Reason: Please use code tags for data and code samples
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with call of Java Programm & return code handling & output to several streams.

Hello Everybody, thanks in advance for spending some time in my problem. My problem is this: I want to call a java-Programm out of my shell skript, check if die return code is right, and split the output to the normal output and into a file. The following code doesn't work right, because in... (2 Replies)
Discussion started by: danifunny
2 Replies

2. Infrastructure Monitoring

Perl Error Handling Problem

I can get this working, but if something is down I get an error and the script does not move on. I can not get the "else" function working. What might I be doing wrong? use SNMP::Simple my %ios = (); $list="list.list"; open(DAT, $list) || die("Can't Open List"); @raw_data=<DAT>;... (4 Replies)
Discussion started by: mrlayance
4 Replies

3. Shell Programming and Scripting

Null Handling in Until loop. . .loop won't stop

Hi Im running this script, which is supposed to find the max value build some tables and then stop running once all the tables are built. Thing is , it keeps assigning a null value to $h and then $g is null so it keep building tables i.e. testupdateNUL. How can I stop this? Here is what I have: ... (4 Replies)
Discussion started by: brandono66
4 Replies

4. Programming

problem in reforking and signal handling

hi friends i have a problem in signal handling ... let me explain my problem clearly.. i have four process .. main process forks two child process and each child process again forks another new process respectively... the problem is whenever i kill the child process it is reforking and the... (2 Replies)
Discussion started by: senvenugopal
2 Replies

5. Programming

problem in SIGSEGV signal handling

i wrote handler for sigsegv such that i can allocate memory for a variable to which sigsegv generated for illlegal acces of memory. my code is #include <signal.h> #include<stdio.h> #include<stdlib.h> #include<string.h> char *j; void segv_handler(int dummy) { j=(char *)malloc(10); ... (4 Replies)
Discussion started by: pavan6754
4 Replies

6. Shell Programming and Scripting

String handling is not working inside if loop

Hi All, I am comparing two strings inside an if condition if the strings are same then it should go inside the loop else it should execute code given in else part. But there is a but inside my script Even if the if condition is true it is not going inside the loop also it is executing... (4 Replies)
Discussion started by: usha rao
4 Replies

7. Shell Programming and Scripting

Problem with awk while handling special charaters

Hi, I have an application.xml file like </dependency> <artifactId>_AdminServicesEAR</artifactId> <version>1.0.0-20080521.085352-1</version> <context-root>oldvalue</context-root> <type>ear</type> <DOCTYPE "abc/xyz/eft"> <NewTag>value123</xyz> ... (4 Replies)
Discussion started by: subin_bala
4 Replies

8. Programming

Problem with handling SIGINT

For a program I am designing, which involves handling the keyboard input Ctrl^c (SIGINT), it is taking ages for the program to actually recognise and perform the corresponding action whenever I run it and hit Ctrl^C at the CL. I have to do at least 3 Ctrl^Cs before the program will actually... (3 Replies)
Discussion started by: JamesGoh
3 Replies

9. UNIX for Dummies Questions & Answers

file handling problem in perl......

Hi, I am opening a file......then i am wrting some data into it......and i am reopening the file again but ......i get a error cannot open file....... $::file= "\adder\testfile.txt" open(TEST1,$::file); some write operation close(TEST1) open(TEST1,$::file) 'I GET A ERROR CAN OPEN... (2 Replies)
Discussion started by: vivekshankar
2 Replies

10. HP-UX

Inter Process File Handling Problem

Hi All, i am running a oracle procedure which writes a file . The same file is picked up by another script which runs in a cron after every 5 minutes. Now the problem is that sometimes my script picks up a file while the procedure is still writing data in the file. is there is any way i... (4 Replies)
Discussion started by: saurabhjain
4 Replies
Login or Register to Ask a Question