"Linux command-File management class" Split command

Source: Internet
Author: User

command function : Cut files, cut files in units of behavior or in bytes
command Syntax :

    • Split [–help][–version]
    • Split [-< number of rows >][-l < rows;] [file to be cut] [output FILENAME]
      , in number of rows
    • Split [-B < bytes >][-c < bytes;] [file to be cut] [output file name], in bytes

The output file name refers to a file that is then prefixed with the cut.

1. Cutting files in a behavioral unit
    • First create a 5-line file Hello,
#cat helloHello, World1Hello, World2Hello, World3Hello, World4Hello, World5
    • Use the command:
#split -2 hello split1_
    • The split command cuts the file in two units, each consisting of a new file, and 5 rows with three files, each with the following names:
2. Cut in bytes
    • Or the file hello, using the command ls-l hello can see the size of the file is 65 bytes, cut the file with 10 bytes, there will be 7 files

    • Use the-B command first, as follows:

#split -b 10 hello split2_
    • There are 7 files cut out,
split2_aa , split2_ab , split2_ac , split2_ad , split2_ae , split2_af , split2_ag
    • The following uses the-c parameter, as follows:
#split -C 10 hello split3_
    • Cut out 10 files and output the following with the Ls-l command:

    • Although the file is also cut in bytes, but the-C parameter will try to maintain the integrity of each line, that is, a row has 13 bytes, then it will be cut into two files, a 10 byte, a 3 byte, and the-B parameter will accumulate 8 bytes to the next line to fill 10 bytes and then cut, so-b parameter only 7 files, The-c parameter has 10 files.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Linux command-File management class" Split command

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.