[One Linux Command every day] 03. Use of pipeline commands in Linux

Source: Internet
Author: User

1. Pipeline commands

Pipeline commandThe operator is: "|". It can only process the correct output information sent from the previous command, but cannot directly process the error information. Then, pass it to the next command as the standard input.

Management command output description:

[Command 1] correct output, as the input of [command 2], and then the output of [command 2] as the input of [command 3, [command 3] The output is directly displayed on the screen.

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

[Note ]:

1. Pipeline commands only process the correct output of the previous command, without handling the error output;

2. The command on the right of the pipeline command must be able to receive standard input stream commands;

Ii. Example

#1. Read the content of the logcat. Log File and forward it to grep through a pipeline as the input content

#2. Read the content of the logcat. Log File and forward it to grep as the input content through the pipeline. filter the rows containing 'displayed' and then forward the output content to the next grep as the input.

#3. Read the content of the logcat. log and wirelessqa. log files. The error content will be printed on the screen, and the correct content will be transmitted to grep through the pipeline

#4. Read the content of the logcat. log and wirelessqa. log files. The error content will be redirected to/dev/null, and the correct content will be transmitted to grep through the pipeline

#5. Read logcat. log and send it to LS through MPs queue. Because ls does not support standard input, the previously read data 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.