The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to store the sql query's output in a variable venkatesh_sasi Shell Programming and Scripting 4 01-18-2008 01:03 AM
To store the output in a variable Sudhakar333 Shell Programming and Scripting 2 07-10-2007 09:45 AM
What is the output of echo * shailja UNIX for Dummies Questions & Answers 4 06-29-2007 10:27 AM
store output to a file and read from it afadaghi Shell Programming and Scripting 2 10-04-2005 01:00 PM
How to store output in variable when put in background sanjay92 UNIX for Dummies Questions & Answers 1 02-22-2005 03:41 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-13-2006
meyerder meyerder is offline
Registered User
  
 

Join Date: May 2006
Posts: 3
Store output and Echo

I will admit I am a newbie but I am trying to write some simple scripts

Situation:

I have a list of IP Addresses that I want to once or 2 times a day store the average ping response time in a database (mysql) I am part way there but not all the way there

I have the following

cat ./slow | while read line
do
for i in $line
do
ping -c1 -q $i | grep "mdev" | gawk -F"/" '{print $5}'
done
done

Which parses the average response time out properly I really would like to have something like the following

But my Question is Why can I not get $i to show up? in the print statment


cat ./slow | while read line
do
for i in $line
do
ping -c1 -q $i | grep "mdev" | gawk -F"/" '{print "update table set field1 ="$5" where field2="$i""}'
done
done

Results
update table set field1 =138.668 where field2=rtt min/avg/max/mdev = 138.668/138.668/138.668/0.000 ms
update table set field1 =209.089 where field2=rtt min/avg/max/mdev = 209.089/209.089/209.089/0.000 ms

Last edited by meyerder; 05-13-2006 at 12:25 PM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0