Solved

Redirecting just stdout through pipe in bash

Posted on 2006-07-12
3
1,525 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

930 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

20 Experts available now in Live!

Get 1:1 Help Now