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

Linux basic command-split

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Split

Cut a large file into smaller files, cutting every 1000 lines by default. The split file is named xaa, xab, xac and so on by default. Users can also specify the prefix of the name, for example, specify the prefix test, then the split files are testaa, testab, testac, and so on.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Split [OPTION]... [INPUT [PREFIX]

2. List of options

Option

Description

-- help

Show help documentation

-- version

Display version information

-a |-- suffix-length=N

Use a suffix of length N (default is 2)

-b |-- bytes=SIZE

Set how many bytes to split at a time

-C size |-- line-size=size

Set a maximum of size bytes per line

-d |-- numeric-suffixes

Replace letters with numeric suffixes

-l num |-- line=num |-num

Set the number of rows to be cut

-- verbose

Print a diagnostic file before opening each output file

3. Examples

1) split every 2 lines

[root@localhost weijie] # split-2 5.c / / split every 2 lines

[root@localhost weijie] # ls

1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c xaa xab xac / / split files will be named automatically

[root@localhost weijie] # cat xaa / / View split files

1,2c1,2

< 123 [root@localhost weijie]# cat xab < 23 --- [root@localhost weijie]# cat xac >

12345

> 2334

2) split every 10 bytes and specify the name prefix of the output file

[root@localhost weijie] # split-b 10 5.c Tsplit / / 10 bytes split, prefix name Tsplit

[root@localhost weijie] # ls

1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c Tsplitaa Tsplitab Tsplitac Tsplitad xaa xab xac

[root@localhost weijie] # cat Tsplitaa

1,2c1,2

< [root@localhost weijie] # cat Tsplitab

one hundred and twenty three

< 23

A Linux learning platform has been made, and a prototype has come out at present, which you can refer to and use.

Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk

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