![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|