The powerful and practical functions of the Linux operating system have led many people to apply the Linux operating system. There will be many problems during the learning process. For example, if you want to send a large video to a friend with hundreds of MB, after trying multiple transmission methods, the last thought was to cut the video into a piece and "mail" it to him to assemble it.
- [root@pps public_rw]# ls -lh RevolutionOS.rmvb
- -rwx------ 1 hoho hoho 276M 2005-09-09 RevolutionOS.rmvb
Split the 276M file into 20 m small files. The operations are as follows:
Usage: split [Option] [input [prefix]
- [Root @ pps public_rw] # split-B 20 m RevolutionOS. rmvb RevOS_part _
- [Root @ pps public_rw] # ls-lh
- Total 552 M
- -Rwx ------ 1 hoho 276 M 2005-09-09 RevolutionOS. rmvb
- -Rw-r -- 1 root 20 M 03-19 17:59 RevOS_part_aa
- -Rw-r -- 1 root 20 M 03-19 17:59 RevOS_part_ AB
- ...
- -Rw-r -- 1 root 20 M 03-19 18:00 RevOS_part_am
- -Rw-r -- 1 root 16 M 03-19 18:00 RevOS_part_an
"-B 20 M" specifies that the size of the split file is 20 M. The "RevOS_part _" after the file is the prefix of the split file, and the last is the 16 M "remaining" file.
Assembly file:
- [root@pps public_rw] cat RevOS_part_* > RevolutionOS_RSB.rmvb
We are not afraid of Assembly Order errors here, because the separation is performed in alphabetical order, and cat is also handled in alphabetical order. If you are not at ease, compare the assembled files.
- [root@pps public_rw]# md5sum RevolutionOS.rmvb
- ac7cce07f621b1ed6f692e6df0ac8c16 RevolutionOS.rmvb
- [root@pps public_rw]# md5sum RevolutionOS_RSB.rmvb
- ac7cce07f621b1ed6f692e6df0ac8c16 RevolutionOS_RSB.rmvb
If you want to split a text file, such as thousands of lines, and the number of characters in each line is not equal, you want to split it by the number of lines. For example, one file is generated for every 100 lines, only the-l parameter is required, as shown below:
[Root @ pps public_rw] # split-l 100 test.txt
In fact, if no parameter is added, the data is split by 1000 rows by default. In this way, the steps for splitting large files by using the split command in Linux are completed.
- Easily connect to the campus network using Linux
- Fully Understand Linux Process Technology
- Introduction to the password command in Linux
- Learn about Linux regulatory commands
- How to view the ps-aux command of all processes in Linux