Usage of pipeline commands in Linux __linux

Source: Internet
Author: User

Original address: http://blog.csdn.net/wirelessqa/article/details/8968381

A. Pipeline command

The pipe command operator is: "|", which can only handle the correct output information that is transmitted through the previous instruction, and has no direct ability to handle the error information. Then, pass to the next command as the standard input.

The output description of the management command:

"Instruction 1" is the correct output, as the input of "instruction 2" and then the output of "instruction 2" as "instruction 3" input, "instruction 3" output will be directly displayed on the screen.

The correct output of "instruction 1" and "instruction 2" is not displayed on the screen after the pipeline is passed

"Reminder Note":

1. The pipeline command only handles the correct output of the previous command and does not handle the error output;

2. Pipeline command to the right, must be able to receive the standard input stream command;

two. Give me a chestnut.

#1. Read the contents of the Logcat.log file and send it through the pipeline to grep as input


#2. Read the contents of the Logcat.log file, transfer the pipe to grep as input, filter the rows containing ' displayed ', and forward the output to the next grep as input.


#3. Read the contents of the Logcat.log and Wirelessqa.log files, the contents of the error will be printed on the screen, and the correct will pass to grep through the pipe


#4. Read the contents of the Logcat.log and Wirelessqa.log files, the contents of the error are redirected to the/dev/null, and the correct channel is passed to grep

#5. read out logcat.log to LS via pipeline, because LS does not support standard input, so the data read before is lost

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.