-   Programming (
-   -   stdout capture anb bring to file (

sqn 07-09-2003 05:04 PM

stdout capture anb bring to file
I want to make a script that will capture/serch for a specified string in the stdout of a program and put it in a file:
i give a ping command to a host and the reply with 0% pachets lost/100% pakets lost i need to put it in a file witch will b emaild to later. The problem is how can i capture that reply?

Thx in advance

PS I use pure shell script

Pres 07-09-2003 08:38 PM

This is too simple I suppose :

ping > /root/grepin
grep -n "packet loss" /root/grepin > /root/grepout

If it's not flexible enough you could go with variables instead.

sqn 07-10-2003 08:42 AM

thx a lot
It's working fine

All times are GMT -5. The time now is 04:34 AM.