Linux Split command detailed _linux Shell

Source: Internet
Author: User

command function : Cutting files, cutting files in units of behavior or in bytes

command Syntax :

Split [–help][–version]

Split [-< line number >][-l < lines [file to be cut] [output FILENAME]
, in number of rows

Split [-B < byte >][-c < bytes] [file to cut] [output filename], in bytes

The output file name refers to the cut file as a prefix.

1. Cutting documents by unit of conduct

First create a file with 5 lines Hello,

#cat Hello
Hello, World1.
Hello, World2.
Hello, World3.
Hello, World4.
Hello, World5.

To use the command:

#split-2 Hello split1_

The split command cuts the file in two behavioral units, each of which consists of a new file, and 5 lines have three files, the names of which are:

Split1_aa, Split1_ab, Split_ac

2. Cutting in bytes

or file hello, using the command ls-l hello can see the file size is 65 bytes, to 10 byte cutting file, there will be 7 files

Use the-B command first, as follows:

#split-B Hello split2_

The file was cut out with 7,

Split2_aa, Split2_ab, Split2_ac, Split2_ad, Split2_ae, Split2_af, Split2_ag

The-c parameter is used below, as follows:

#split-C Hello split3_

10 files were cut out, with the ls-l command output as follows:

Although the same is done in bytes, the-c parameter keeps the integrity of each row as much as possible, that is, a row has 13 bytes, then it will be cut to two files, a 10 byte, a 3 byte, and the-B parameter will accumulate 8 bytes to the next line to make up 10 bytes and then cut, so the-b parameter only 7 files, The-c parameter has 10 files.

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.