Linux uses Xargs to get strings as arguments for output, and awk to get strings as arguments for output

Source: Internet
Author: User

Background:

Cat Test.txt 1 3 4

Instance:

1, Xargs

Cat Xargs Echo {}
Cat Xargs Echo {}

The case I parameter is not the same effect, the lowercase i default parameter is {}, and cannot be changed, and the uppercase I parameter is custom, can be {}, a ... Wait a minute.

2. awk

Awk is becoming a language, and {} code blocks can be written using the shell, which is equivalent to a dynamic language.

Cat awk ' {print $} '

$n: the nth field of the current record, for example, N is 1 for the first field, and N for 2 for the second field.

$: This variable contains the text content of the current line during execution.

Reference:

Http://man.linuxde.net/awk

Http://man.linuxde.net/xargs

Linux uses Xargs to get strings as arguments for output, and awk to get strings as arguments for output

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.