Shell Command xargs

Source: Internet
Author: User

Shell commandsXargs

Build and execute command lines from standard input

Xargs can be readStdinAnd use a space character or line break character as the resolutionStdinData is separatedArguments.

1) Description

Xargs [-0epn] command

Options and parameters:

-0: If the input stdin contains special characters, for example, ', \, when the blank key and other characters, this

-E: This is EOF (end of file) . A string can be followed when xargs when this string is parsed, it stops working!

-P: InArgumentWill ask the user's meaning;

-N: Number of followed calls, each timeCommandWhen executing a command, several parameters are required.

WhenXargsWhen no command is followed, the default isEchoOutput!

2) Example

Cut-d ":"-F1/etc/passwd | tail-N 5 | xargs finger

3) UseXargsThe reason is that many commands do not actually support pipeline commands, so we canXargsTo provide this command referenceStandard Input.

Find./-name Prime. cpp | LS-l // The output is not what we think, becauseLsMPs queue is not supported.

Find./-name Prime. cpp | xargs LS-l

Original

[1]Http://linux.vbird.org/linux_basic/0320bash.php

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.