Linux Split split large file instance detailed

Source: Internet
Author: User

Linux Split command

Function Description: Cutting file.

Syntax: Split [--help][--version][-< rows >][-b < bytes >][-c < bytes >][-l < lines >][files to cut [output FILENAME]

Add: Split can cut the file into smaller files, preset every 1000 lines cut into a small file.

Parameters

-< number of rows > or-l< > Specifies how many rows to cut into a small file.

-b< bytes > Specifies how many words will be cut into a small file. Support Unit: M,k

The-c< byte > is similar to the-B parameter, but as much as possible to maintain the integrity of each row while cutting.

--help display Help.

--version Displays version information.

[Output file name] Sets the file's predecessor file name after the cut, and split automatically adds the number after the previous file name.

File segmentation with split under Linux:

Mode One: Specifies the number of rows after the split file

For a text file, you can split the file by specifying the number of rows in the split file.

Command: Split-l large_file.log new_file_prefix

Mode two: Specify File size after split

The code is as follows Copy Code

Split-b 10m Server.log Server_prefix

We can also separate files by file size for binary files.

Split file file.tar.gz into a file with "File_" as the filename prefix with a size of 10M

The code is as follows Copy Code
$split-B 10m file.tar.gz File_

File merging with cat under Linux:

Command: Cat small_files* > Large_file

Merging a split file

The code is as follows Copy Code

$cat file_* > file.tar.gz

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.