In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use the split command to split the Linux file", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the split command to split the Linux file" this article.
Some simple Linux commands allow you to split and reassemble files as needed to accommodate storage or email attachment size restrictions.
The Linux system provides a very easy-to-use command to split files. You may need to do this before uploading files to a limited-size storage site or as an email attachment. To split a file into multiple file blocks, simply use the split command.
$split bigfile
By default, the split command uses a very simple naming scheme. File blocks will be named xaa, xab, xac, etc., and, roughly, if you split a file large enough, you may even get blocks named xza and xzz.
Unless you request it, the command will run without any feedback. However, if you want to see feedback when creating a file block, you can use the-- verbose option.
$split-- verbose bigfilecreating file 'xaa'creating file' xab'creating file 'xac'
You can also name the file a prefix. For example, to split your original file and name it bigfile.aa, bigfile.ab, and so on, you can add a prefix to the end of the split command, as follows:
$split-- verbose bigfile bigfile.creating file 'bigfile.aa'creating file' bigfile.ab'creating file 'bigfile.ac'
Notice that a dot is added to the end of the prefix shown in the above command. Otherwise, the file will have a name such as bigfileaa, not bigfile.aa.
Note that the split command does not delete your original file, it just creates a file block. If you want to specify the size of the file block, you can use the-b option to add it to the command. For example:
$split-b100m bigfile
The file size can be KB, MB,GB, and the maximum can be YB! Just make the appropriate letters K, M, G, T, P, E, Z and Y.
If you want to split the file based on the number of lines in each block rather than the number of bytes, you can use the-l (line) option. In this example, each file will have 1000 lines, and of course, the last file may have fewer lines.
$split-- verbose-L1000 logfile log.creating file 'log.aa'creating file' log.ab'creating file 'log.ac'creating file' log.ad'creating file 'log.ae'creating file' log.af'creating file 'log.ag'creating file' log.ah'creating file 'log.ai'creating file' log.aj'
If you need to reassemble files on a remote site, you can easily do so using the cat command shown below:
$cat Xbox? > original.file$ cat log.?? > original.file
The split and combine commands shown above are suitable for binary and text files. In this example, we split the zip binaries into blocks of 50KB, then reassembled them using cat, and then compared the combined file with the original file. The diff command verifies that the file is the same.
$split-- verbose-b50K zip zip.creating file 'zip.aa'creating file' zip.ab'creating file 'zip.ac'creating file' zip.ad'creating file 'zip.ae'$ cat zip.a? > zip.new$ diff zip zip.new$
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.