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

How to use cut and sort of linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the relevant knowledge of "how to use cut and sort of linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Cut usage of linux

Cut is a select command that analyzes a piece of data and takes out what we want. Generally speaking, the selected information is usually analyzed according to the "row", not the whole piece of information.

(1) its grammatical format is:

Cut [- bn] [file] or cut [- c] [file] or cut [- df] [file]

instructions

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

If you do not specify the File parameter, the cut command reads standard input. One of the-b,-c, or-f flags must be specified.

Main parameters

-b: split in bytes. These byte positions ignore multibyte character boundaries unless the-n flag is also specified.

-c: split on a character basis.

-d: custom delimiter, default to tab.

-f: used with-d to specify which area to display.

-n: unsplit 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 will be written out; otherwise, the character will be excluded.

(2) what is the general basis of cut? In other words, how do I tell cut about the clips I want to locate?

The cut command mainly accepts three positioning methods:

First, byte (bytes), with the option-b

Second, the character (characters), with the option-c

Third, fields (domain), with the option-f

Sort usage of linux

The sort command helps us sort according to different data types, its syntax and common parameter formats:

Sort [- bcfMnrtk] [source file] [- o output file]

Additional note: sort can sort the contents of the text file by behavior unit.

Parameters:

-b ignores space characters that begin at the beginning of each line.

-c check whether the files have been sorted in order.

When sorting, uppercase and lowercase letters are ignored.

-M sorts the first three letters according to the abbreviation of the month.

-n is sorted by the size of the number.

-o saves the sorted results to the specified file.

-r is sorted in reverse order.

-t specifies the field delimiter used for sorting.

-k chooses which interval to sort.

This is the end of the content of "how to use cut and sort of linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Internet Technology

Wechat

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

12
Report