Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

blah | blah | blah
share|improve this question
add comment

3 Answers

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
add comment

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

share|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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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