Friday, May 21, 2010

Pipe operator in Unix!?

what is the usage of pipe operator in unix? how does this damn thing work? Please explain with an example.

Pipe operator in Unix!?
Each command has standard output and standard input. The pipe operator just makes the output of the last command the input of the next command. Here's a simple example you can try:





echo hi | sed s/hi/bye/





Sed will transform the output of echo, which is "hi," into "bye," and you will see it on standard output.





Cheers,
Reply:The output of the last command will be the input of the next.


ls -al|grep myfile


ls -al would usually list everything, grep filters the output of it so that only the line with string 'myfile' is shown.

flowers delivery

No comments:

Post a Comment