LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-09-2003, 04:04 PM   #1
sqn
Member
 
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:
example
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, 07:38 PM   #2
Pres
Member
 
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Rep: Reputation: 30
This is too simple I suppose :

ping 192.168.1.1 > /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, 07:42 AM   #3
sqn
Member
 
Registered: Apr 2002
Distribution: Ubuntu, Arch, freeBSD, Slackware
Posts: 210

Original Poster
Rep: Reputation: 30
Smile

thx a lot
It's working fine
 
  


Reply



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 08:35 PM
stdout to file Machiaveli Programming 8 09-04-2005 08:53 AM
stdout contents capture arvind_tyche Programming 1 06-24-2004 06:08 AM
how to output stdout to a file SciYro Linux - Newbie 4 02-25-2004 05:08 PM
capturing STDOUT to file. tn1681 Programming 5 11-01-2002 11:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:05 PM.

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