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

blah | blah | blah
link|improve this question

feedback

3 Answers

up vote 10 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

link|improve this answer
feedback

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

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

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.