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

Split,csplit command: file cutting

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Split and csplit are two methods of file cutting.

Split

Common options:

-b: cut in block size, commonly used units are k (kb), M (MB), G (GB)

Example: split-b 10k server.log cuts the contents of the original file into a file every 10k

-l: cut in rows

Example: split-l 8 server.log cuts the contents of the original file into a file every 8 lines

-d: the cut files are distinguished by numbers, for example, the file name of the split file is 01j02j03,

For example, if split-l 8 server.log-d does not specify a prefix, the default cut file is x00menx01recoverx02

-a: indicates the number of digits of the file number generated after the file is cut

Example: split-L8 server.log-d-a 4 the file number generated after cutting starts with 0000

PREFIX: add the specified prefix, only at the end of the command

Example: split-l8 server.log-d-a 4 test is cut to generate a file with the suffix test

Csplit: you can use the specified content as a cutting condition

# csplit server.log / SERVER/-n 2-s {*}-f server-b "d.log"

Common options:

/ SERVER/: specifies the conditions for cutting, where SERVER is used as the keyword, that is, cutting is performed only when SERVER appears in the current line

-n: specify the length of the file number after cutting; (for example,-n 2, indicating the cut file number 001.01)

-s: use the command to enter silent mode without printing other information

{*}: specify the number of cuts from top to bottom. * means to repeat the cutting until the end of the file. When * is a number, it means several cuts.

-f: specifies the prefix of the file after cutting

-b: specify the suffix of the file after cutting

D.log: indicates that the sliced file is 00.logjor 01.log

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

Network Security

Wechat

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

12
Report