Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of the Linux basic command cut

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the usage of the Linux basic command cut". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of the basic Linux command cut.

Cut

Displays the specified contents of each line in the file to standard output. The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Cut [options] file

2. List of options

Option

Description

-- version

Display command version information

-- help

Show help documentation

-b |-- bytes=LIST

Set the number of bytes or range of output

-c |-- characters=LIST

Sets the number or range of characters output

-d |-- delimiter=DELIM

Specifies the delimiter for the column. The default is tab.

-f |-- fields=LIST

Show split columns

-n

Used with "- b", do not split multibyte characters

-- complement

Supplement the selected set of bytes, characters, or fields

-- output-delimiter=STRING

Use STRING as the output delimiter, which defaults to the input delimiter

-s |-- only-delimited

If the line does not have a delimiter, the line is not displayed

3. Examples

Display as: split column 3

[root@localhost weijie] # cat / etc/passwd / / View content

Root:x:0:0:root:/root:/bin/bash

Bin:x:1:1:bin:/bin:/sbin/nologin

Daemon:x:2:2:daemon:/sbin:/sbin/nologin

Adm:x:3:4:adm:/var/adm:/sbin/nologin

Lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin

[root@localhost weijie] # cut-f 3-d: / etc/passwd / / display the third column with: as the delimiter

one

two

three

four

At this point, I believe you have a deeper understanding of "the use of the Linux basic command cut". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report