Solved

Redirecting just stdout through pipe in bash

Posted on 2006-07-12
3
1,524 Views
Last Modified: 2008-01-09
With a program I am using when I run this command:

          mycommand | grep hello

I get:

          Running...
         
          Done!
          Well hello there, how are you doing?

But when I run:

          mycommand|grep hello 1> hello.txt

I see:

          Running...
         
          Done!

And then when I cat "hello.txt" I get:

          Well hello there, how are you doing?

...which is what I want to get, but through a pipe (without having to cat the file afterwards).

How can I do this (just get the stdout, but through the pipe instead of on redirection)?  I've seen this in multiple programs.  Also, what category does the "Running..." and "Done!" fit under if not stdout?
0
Comment
Question by:Autogard
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
pjedmond earned 500 total points
ID: 17092775
Running..." and "Done" come under the stderr output. stderr(2) is also used for information that is not 'true output of the program concerned.

What you possibly require is:

mycommand 2>/dev/null | more

(   (()
(`-' _\
 ''  ''



0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17092787
http://www.tldp.org/LDP/abs/html/io-redirection.html

gives a much fully description of what can be done:

(   (()
(`-' _\
 ''  ''

0
 
LVL 8

Author Comment

by:Autogard
ID: 17092849
Ahah! Exactly. Thanks! I'm using "mycommand 2>/dev/null | grep hello" and it works perfectly!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now