Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirecting just stdout through pipe in bash

Posted on 2006-07-12
3
Medium Priority
?
1,532 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
pjedmond earned 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

670 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