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 8369343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:37:09+00:00 2026-06-09T13:37:09+00:00

How can I pipe the stdout of multiple commands to a single command? Example

  • 0

How can I pipe the stdout of multiple commands to a single command?

Example 1: combine and sort the output of all three echo commands:

echo zzz; echo aaa; echo kkk

desired output:

aaa
kkk
zzz

Example 2: rewrite the following so that all the commands are in a single command-line using pipes, without redirects to a temp file:

setopt > /tmp/foo; unsetopt >> /tmp/foo; set >> /tmp/foo; sort /tmp/foo
  • 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-09T13:37:10+00:00Added an answer on June 9, 2026 at 1:37 pm

    Use parentheses ()’s to combine the commands into a single process, which will concatenate the stdout of each of them.

    Example 1 (note that $ is the shell prompt):

    $ (echo zzz; echo aaa; echo kkk) | sort
    aaa
    kkk
    zzz
    

    Example 2:

    $ (setopt; unsetopt; set) | sort
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I redirect or pipe the output of an ex command into my
The program can read all the data from the pipe. However, the program just
If I have 2 pipe delimited files containing bookmark data, for example. How can
I need to run a Linux CLI command and get its stdout output from
How can I feed data from one pipe to three different processes? nulfp =
How can I pipe several external commands together in Go? I've tried this code
I'm running into some difficulties getting output from a subprocess stdout pipe. I'm launching
How can I pipe between two separate console application running in different console windows?
I am trying to implement a shell in C. I can execute simple commands
I need a program that I can pipe a raw PCM stream into, and

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.