Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Last year at the Linux show in NYC, I noticed that Microsoft had a nice tool. The guy demonstrated all these things from cmd.exe and one of them was the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319

    Piping on cmd.exe


    Last year at the Linux show in NYC, I noticed that Microsoft had a nice tool. The guy demonstrated all these things from cmd.exe and one of them was the ability to use the pipe.

    Does anyone know what this product is? I know I can install cygwin but I'm curious to know what this product is called.
    The best things in life are free.

  2. #2
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    Pipe, in Linux, is the ablity to use the output of one command as the input to another through the use of what's called a pipe. The pipe operator is | (shft + \). As an example, the cat command displays the contents of a file. Lets say file test contains the values 1,2,3,4 on seperate lines.

    Code:
    cat test
    Would output

    1
    2
    3
    4

    The command grep pattern filename searches for pattern in filename. You can put the two together using a pipe.

    Code:
    cat test | grep 3
    will search the output of cat for the pattern 3. This example may seem lame, but consider searching the contents of /var/log/Xorg.0.log for errors. There may be hundreds of lines in the log. If there was an error, the line starts EE and lists the error.

    Code:
    cat /var/log/Xorg.0.log | grep EE
    Will print only the errors.

    Hope that helps,
    Jeremy
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  3. #3
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    jeremy1701,
    i think bpark was asking how to get pipes working on windows.
    if that's your question: you can use pipes on cmd.exe without any additional software. piping and subdirectories were two things that ms-dos "borrowed" from UNIX.
    -lakerdonald

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    Ahh, I see.

    I forgot that cmd.exe has redirection including the functionality of piping.

    I guess the only thing then would be to install cygwin and edit the path env for those additional programs.
    The best things in life are free.

  6. #5
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    wait what? why would you need to edit stuff? piping is part of the DOS shell to the core

  7. #6
    Linux Enthusiast scientica's Avatar
    Join Date
    Sep 2003
    Location
    South- or "Mid-" Sweden
    Posts
    742
    let me thingk, the so called pipe line rediercting ad modum BigCorp is eitehr terrible broken or just a bad implementation... iirc, winDOS only supports (parts of) the most rudamentary redirection:
    '>', '>>' and '|' ('2>' or something like that *should* work, but I nerver got it to work in windos... )
    Regards Scienitca (registered user #335819 - http://counter.li.org )
    --
    A master is nothing more than a student who knows something of which he can teach to other students.

  8. #7
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    i never got what 2> did...

  9. #8
    Linux Engineer
    Join Date
    Sep 2003
    Location
    Knoxhell, TN
    Posts
    1,078
    it redirects a file descriptor...
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  10. #9
    Linux User
    Join Date
    Jul 2004
    Posts
    256
    Quote Originally Posted by lakerdonald
    i never got what 2> did...
    Code:
    $ man bash
    0 - standard input
    1 - standard output
    2 - standard error output
    --monkey

  11. #10
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    Lakedonald:

    After installing Cygwin, the PATH env variable in Windows needs to be edited to add the directory path to the newly installed Cygwin programs.

    Piping is built into the shell. There's nothing you need to edit for this part.
    The best things in life are free.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •