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

An example of the method of dividing Files with csplit Command under linux

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

Share

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

Applicable scenario

The csplit command is used to split a large file into small fragments and save each fragment into a file. The csplit command-> splits the file according to the specified paradigm and saves it as xx00,xx01. The document.

Disassembly files are mainly split and csplit commands. If split is split by size, then csplit can be split by match.

Option interpretation

$csplit-h / [regular expression] / # matches the text style, such as / SERVER/, from the first line to the matching line containing SERVER. {*} # means that the split is repeated according to the match until the end of the file stops, specifying the number of times the split is performed in the form of {integer}. -s # silent mode, no other information is printed. -n # specifies the number of digits of the split file name suffix. For example, 01, 02, 03 and so on. -f # specifies the split file name prefix. -b # specifies the suffix format. D.log, for example, is similar to the printf parameter format in the C language.

Usage

$csplit filename / match/-N2 {*}-f aa-b ".log"

Summary

The above is the whole content of this article, I hope that the content of this article can bring some help to your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

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