In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the Linux command csplit, which is very detailed and has a certain reference value. Friends who are interested must finish reading it!
The Linux common command csplit command is used to split a large file into small fragments and save each fragment into a file.
Syntax csplit [- kqsz] [- b] [- f] [- n] [--help] [--version] [file] [template style.] Parameters:
-b or-suffix-format= preset output format with the file name xx00,xx01... You can change the file name of the output by changing it, etc.
The output header string of the-f or-prefix= preset has the file name xx00,xx01... If you specify the output prefix string as "hello", the output file name will become "hello00,hello01". Wait.
-k or-keep-files keep the file, and even if an error occurs or interrupts execution, you cannot delete the saved file that has been output.
The number of output file names preset by-n or-digits= and the file name is xx00,xx01. Etc., if you specify that the number of output file names is "3", the output file name will become xx000,xx001 … etc.
-Q or-s or-quiet or-silent does not show instruction execution.
-z or-elide-empty-files deletes a Byte file of length 0.
-help online help.
-version displays version information.
The content of the instance test file server.log
Cat server.log SERVER-1 [con] 10.10.10.1 suc [con] 10.10.10.2 fai [dis] 10.10.10.3 pen [con] 10.10.10.4 suc SERVER-2 [con] 10.10.10.5 suc [con] 10.10.10.6 fai [dis] 10.10.10.7 pen [con] 10.10.10.8 suc SERVER-3 [con] 10.10.10.9 suc [con] 10.10.10 .10 fai [dis] 10.10.10.11 pen [con] 10.10.10.12 suc 12345678910111213141516 need to split server.log into server1.log, Server2.log 、 server3.log The contents of these files are taken from different SERVER sections of the original file:
[root@localhost split] # csplit server.log / SERVER/-N2-s {*}-f server-b "d.log"; the rm server00.log [root@localhost split] # ls server01.log server02.log server03.log server.log 123 command details: / [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. Rm server00.log # deletes the first file because the split first file has no content and the matching word is on the first line of the file.
The above is all the contents of the article "how to use Linux commands csplit". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.