Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8466549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:22:26+00:00 2026-06-10T15:22:26+00:00

If I have a process a.out I can do ./a.out | grep foo to

  • 0

If I have a process a.out I can do ./a.out | grep foo to see stdout of a.out filtered by foo. I can also say ./a.out 2>&1 | grep foo to see both err and out filtered by foo. With the tee command I can send stdout to both the terminal and possibly a file output. But is there a way to filter those separately? as in:

./a.out | tee grep foo file.txt

but such that what goes to file.txt is filtered to match foo but not what I see on the screen…or even better what I see on the screen gets filtered by baz instead of foo? If there isn’t a way to do so in bash already I would write my own “tee” but I would imagine there is some way…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:22:27+00:00Added an answer on June 10, 2026 at 3:22 pm

    Very easy, just use process substitution for your file handles:

    ./a.out | tee >(grep foo > out.txt) | grep baz
    

    Note also that tee can take as many arguments as you like, so you can do things like:

    ./a.out | tee >(grep foo > foo.txt) >(grep bar > bar.txt) [etc]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a process/Linux, which runs out of memory very soon, and I wonder
I have read about storing session state out-of-process but still in memory by configuring
I'm trying to figure out how XSLT process namespace prefixes and have following example:
I have a console app that performs a lengthy process. I am printing out
I have been having some trouble figuring out how exactly I get a process's
I have a process where a CSV file can be downloaded, edited then uploaded
Which threading model is best for this scenario: I have a process can take
I have a process that runs in it's own thread and can be started/stopped
Basically, I have a process that is broken out into 4 forms (thus, 4
hi i have used sys_getpid() from within kernel to get process id how can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.