Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-09-2003, 05:04 PM   #1
Registered: Apr 2002
Distribution: Ubuntu, Arch, freeBSD, Slackware
Posts: 210

Rep: Reputation: 30
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
Old 07-09-2003, 08:38 PM   #2
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Rep: Reputation: 30
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.
Old 07-10-2003, 08:42 AM   #3
Registered: Apr 2002
Distribution: Ubuntu, Arch, freeBSD, Slackware
Posts: 210

Original Poster
Rep: Reputation: 30

thx a lot
It's working fine


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirecting to file and stdout Quantum0726 Programming 3 11-14-2005 09:35 PM
stdout to file Machiaveli Programming 8 09-04-2005 09:53 AM
stdout contents capture arvind_tyche Programming 1 06-24-2004 07:08 AM
how to output stdout to a file SciYro Linux - Newbie 4 02-25-2004 06:08 PM
capturing STDOUT to file. tn1681 Programming 5 11-01-2002 12:51 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration