Linux--cut command

Source: Internet
Author: User

Cut command: Extracts fragments in each line of a file

cut [OPTION] ... [FILE] ...

Description (DESCRIPTION)

The extracted fragments are displayed in standard output in each row of the file.

-B,--bytes=list

Output these bytes

Instance:

[Email protected] ~]# Cat/etc/gshadow |cut-b 1-5

Root

Bin::

Daemo

SYS::

Adm::

Tty::

-C,--characters=list

Output these characters

Instance:

[Email protected] ~]# Cat/etc/gshadow |cut-c 1,3,5

Ro:

Bn

Deo

Ss:

Am:

Ty

-D,--delimiter=delim

Replace TAB field separator with DELIM

-F,--fields=list

Output these fields

Instance:

Separated by a colon, remove lines 6th through 10th of the/etc/passwd file

[[email protected] ~]# cat/etc/passwd |cut-d:-F 6-10

/root:/bin/bash

/bin:/sbin/nologin

/sbin:/sbin/nologin

/var/adm:/sbin/nologin

/var/spool/lpd:/sbin/nologin

/sbin:/bin/sync

/sbin:/sbin/shutdown


Linux--cut command

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.