csplit: take the ax and split large files into parts

Viking ax

Like the famous Hacha program, for Linux there is a very similar one with a GUI called Hoz that we have talked about in the past. But today we are going to introduce you to the use of csplit command, a command line tool with the same objective as the previous programs, that is, to divide large files into parts so that they are not so heavy.

With csplit we will achieve that files that are too heavy they can be divided into parts of a certain size so that they can be better handled. For example, if we have an intermittent or slow connection, it is better to handle light files to avoid that in the middle or when the transfer of a large file is ending when we have been waiting for a long time, everything is annoying and we have to start over. Or to attach files in several emails so that they do not exceed the limit imposed by the mail server, etc.

The csplit syntax is

csplit [opciones] fichero num_partes ...

The Available options more interesting are:

Option, Description

-f, To determine a prefix or pattern for the parts instead of the default "xx".

-n, To specify the number of digits in the suffix instead of 2 by default (xx00).

-s, Silent mode to throw no output.

–Help, Displays help on the available options.

For example, to divide 4-part example with the name "part":

csplit example 4 -f part

For, put it back together a simple one is enough (where n is the last part):

cat parte[0-3] > ejemplo

And we go from part00, part01, part02 and part03 to have our example file again.

That's how simple the basic use of csplit is to divide our files into parts. There are more options, but for beginners who do not know it yet and need a mini-tutorial to get started, this is enough. If you have questions or suggestions, you can leave your comments. You'll be welcome!


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

A comment, leave yours

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   g laugh said

    Thanks! Very useful!