Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to do a command in Linux with "double pipes", like this?

blah | blah | blah
share|improve this question
up vote 11 down vote accepted

Yes, as many as you like.

$ ls -al

gives this

total 25
drwxr-xr-x+ 1 nifle None 4096 2010-04-11 11:34 .
drwxrwxrwt+ 1 nifle root    0 2010-02-09 18:46 ..
-rw-------  1 nifle None 4581 2010-06-10 20:34 .bash_history
-rwxr-xr-x  1 nifle None 1150 2010-02-09 16:42 .bash_profile
-rwxr-xr-x  1 nifle None 3754 2010-02-09 16:42 .bashrc
-rwxr-xr-x  1 nifle None 1461 2010-02-09 16:42 .inputrc
-rwxrwxrwx  1 nifle None  308 2010-04-11 11:38 so.pl

If I pipe that through grep, sed and cut like this:
$ ls -al | grep prof | sed 's/i/XX/g' | cut -c 10-
I get
x 1 nXXfle None 1150 2010-02-09 16:42 .bash_profXXle

share|improve this answer

Yes, you can use as many pipes as you want (and as long as it makes sense with the commands ;))

share|improve this answer
5  
Strictly speaking, it doesn't even need to make sense. But it helps. – Ignacio Vazquez-Abrams Jun 18 '10 at 20:46

You can use as many pipes as long as your pass input into a command that accepts input.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .