Split and merge files in Linux

Source: Internet
Author: User
You can use split and cat to cut merged files in linux. The following are some examples. 1. there are two file cutting modes: the binary mode of text files. 1.1 Text mode the text mode is only applicable to text files. In this mode, each file after being cut can be...
You can use split and cat to cut merged files in linux. The following are some examples. 1. there are two file cutting modes: the binary mode of text files. 1.1 The text mode is only applicable to text files. In this mode, each file after being cut is readable. The text mode is divided into two types: cutting by the maximum file size and cutting by the number of lines of text. 1.1.1 maximum file size cut split-C 5 k duanxin split the text file duanxin according to the size of each piece up to 5 k, without breaking lines. The output file name is similar to splitaa, splitab ...... Split-B 5 k duanxin split each part (of course, the last one is not guaranteed) is 5 k in size and may break rows. 1.1.2 split-l 100 duanxin split by the number of lines in text, 100 rows in each part, regardless of the size. It should be useful in log analysis. 1.2 binary split-B 5 k duanxin split each part (of course, the last one is not guaranteed) is 5 k in size and is basically unreadable. This cutting mode can be used for any type of files. 2. file merging cat split *> newduanxin does not change regardless of the method used for splitting. 3. for other splits, you can use the-a option to specify the length of the output file name. For example, split-l 100-a 3 duanxin split, the output file is similar to splitaaa and splitaab. If this parameter is not specified, the default value is 2. Use-B or-C to specify the block size. the available units are: B for 512 bytes, k for 1 Kbytes, and m for 1 Megbytes. split parameter:-a, -- suffix-length = N specifies the suffix of the output file name. The default value is 2-B, -- bytes = SIZE specifies the number of bytes of the output file-C, -- line-bytes = SIZE in each output file, the maximum number of bytes in a single row-d, -- numeric-suffixes uses numbers instead of letters for suffix-l, -- lines = NUMBER indicates the NUMBER of columns in each output file.
By glf2002lucky
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.