In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Csplit
Splits the file according to the specified pattern. The default output file names are xx00, xx01, xx02, and so on. The instruction shows the size of each output file. The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.
1. Grammar
Csplit [options] file format
2. List of option formats
Option
Description
-- hep
Show help documentation
-- version
Display version information
-b |-- suffix-format=FORMAT
Use sprintf format instead of d
-f name |-- prefix=PREFIX
Specify the prefix name of the output file instead of using "xx"
-k |-- keep-files
Do not delete the wrong output file
-n num
Specifies the number of characters in the output file name, which refers to the sequence number length in the file name
-z |-- elide-empty-files
Delete empty file
-s |-- quiet |-- silent
Does not display the size of the output file
Format
Description
Integer number
Does not include the specified line and uses it as the file block boundary
/ expression / [offset]
Do not include matching lines and use them as file block boundaries
% expression% [offset]
Skip the number of matching lines in advance and use it as the file partition boundary
{Integer}
Repeats the previously specified pattern a specified number of times
{*}
Repeat the previously specified pattern as many times as possible
3. Examples
1) split the file from line 2
[root@localhost weijie] # cat 1.c / / View the file
Hello world
I am david.
I love linux
Love code.
[root@localhost weijie] # csplit 1.c 2 / / split from line 2, and output the split file size
fourteen
thirty-nine
[root@localhost weijie] # ls
11.c 1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c 6.c test Tsplitaa Tsplitab Tsplitac Tsplitad xaa xab xac xx00 xx01
[root@localhost weijie] # cat xx00 / / View the output file
Hello world
[root@localhost weijie] # cat xx01
I am david.
I love linux
Love code.
2) set the name of the generated file
[root@localhost weijie] # csplit-n 3-f te 1.c 3 / / specifies the output copy prefix te with a length of 3 names. Here, the sequence number in the file name is 3 lengths.
twenty-seven
twenty-six
[root@localhost weijie] # ls
11.c 1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c 6.c te000 te001 test
[root@localhost weijie] # cat te000 / / View files
Hello world
I am david.
[root@localhost weijie] # cat te001
I love linux
Love code.
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.
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.