Linux text segment cropping command cut

Source: Internet
Author: User

The Linux Cut command shows each line of text from the beginning to the NUM1 to num2.

Grammar

Cut  [-bn] [File]cut [-c] [file]cut [-DF] [file]

Instructions for use:

The cut command cuts bytes, characters, and fields from each line of the file and writes those bytes, characters, and fields to standard output.

If you do not specify a file parameter, the Cut command reads standard input. One of the-B,-C, or-f flags must be specified.

Parameters:

-B: Split in bytes. These byte locations will ignore multibyte character boundaries unless the-n flag is also specified. -C: Split in characters. -D: Custom delimiter, default is tab. -F: Used with-D to specify which area to display. -N: Cancels splitting multibyte characters. Used only with the-B flag. If the last byte of a character falls within the range indicated by the List parameter of the-B flag, the character is written out;

Instance

When you execute the WHO command, you will output something like this:

W.H.O.
rocrocket:0           2009-01-08 11:07rocrocket pts/0        2009-01-08 11:23 (: 0.0)rocrocket pts/1        2009-01-08 14:15 (: 0.0)

If we want to extract the 3rd byte of each row, that's it:

Who|cut-b 3
Cc

Transferred from: http://www.runoob.com/linux/linux-comm-cut.html

Linux text Segment cropping command cut (GO)

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.