1

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

blah | blah | blah
11

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

4

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

  • 6
    Strictly speaking, it doesn't even need to make sense. But it helps. – Ignacio Vazquez-Abrams Jun 18 '10 at 20:46
1

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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