Shell Basics (ii) Cut usage

Source: Internet
Author: User

Shell Basics (ii) Cut usage

Syntax: cut-d ' delimited character ' [-CF] n

-D after specifying delimiters , single quotation marks, must be a single character

-f Specifies the paragraph, which can be separated by commas with multiple numbers

-C is followed by a number that indicates the intercept of the first few characters

-D followed by the delimiter character, where a colon: as the delimiter character,-F 1 is the first paragraph.

Note: The-F and 1 direct spaces are optional.

-D and-C cannot be used simultaneously

# Cut- d ': ' -f 3/etc/passwd ' followed by single quotation marks "

# Cut- D:-F 3/etc/passwd "-D after direct delimiter, without spaces"

# cut-d:-F 3,6,5 passwd "intercept two paragraphs, separated by commas, the numerical order can be reversed, but the results shown are subject to actual,

For example,-f 3,6,5 shows the result is-f 3,5,6 "

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/8E/DE/wKiom1jN6FKR3TznAAAjzV0EjZo953.png-wh_500x0-wm_ 3-wmp_4-s_523431787.png "title=" UU. PNG "alt=" Wkiom1jn6fkr3tznaaajzv0ejzo953.png-wh_50 "/>

#echo ' 1 2 3 ' > 1.txt

#cut-D "-F 2 1.txt" delimiter is a space, you need to specify a space, enclosed in single quotation marks "

Therefore, it is recommended that the-D followed by a single quotation mark to avoid problems. develop habits.

- c intercept characters, including letters, numbers, symbols

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8E/DC/wKioL1jN57jy9KaqAAAdo0fgDbI613.png-wh_500x0-wm_ 3-wmp_4-s_2855201746.png "title=" CC. PNG "alt=" Wkiol1jn57jy9kaqaaado0fgdbi613.png-wh_50 "/>

This article is from the "Wu Fei" blog, please be sure to keep this source http://wutengfei.blog.51cto.com/10942117/1908049

Shell Basics (ii) Cut usage

Related Article

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.