csplit is a command-line utility that divides a text file into sections according to line numbers or regular expressions. It is part of GNU Coreutils and is useful when a document or data file contains identifiable boundaries between sections.
Unlike split, which normally divides input into fixed-size pieces or groups of lines, csplit determines its output boundaries from patterns supplied by the user. This makes it suitable for separating documents containing repeated headings, dividing logs at particular records or extracting sections from structured text files.
The utility supports several pattern types, including absolute line numbers, regular-expression matches and repeated expressions. Users can also control whether matching lines are retained, adjust output filenames and choose how empty sections are handled.
This is free and open source software.
Key Features
- Split text files according to specified line numbers.
- Identify section boundaries using regular expressions.
- Use positive or negative line offsets relative to matching expressions.
- Skip sections using patterns enclosed in percent signs.
- Repeat a previous pattern a specified number of times.
- Repeat a pattern until the input is exhausted.
- Read input from a named file or standard input.
- Generate sequentially numbered output files.
- Change the output filename prefix using –prefix.
- Configure the numeric suffix format using –suffix-format.
- Choose the number of digits in output filenames.
- Suppress output files containing no data.
- Remove matching boundary lines using –suppress-matched.
- Preserve output files after an error using –keep-files.
- Suppress the normal output of byte counts using –quiet or –silent.
- Display the number of bytes written to each output file by default.
Website: www.gnu.org/software/coreutils
Support:
Developer: Stuart Kemp, David MacKenzie and GNU Coreutils contributors
License: GNU General Public License v3.0

csplit is written in C. Learn C with our recommended free books and free tutorials.
| Explore Linux | |
|---|---|
| Best Free and Open Source Software - A huge collection of recommended free and open source software covering every major category. | |
| In-depth Linux Software Reviews - Detailed assessments of Linux software covering features, usability and overall quality. | |
| The Big List of Active Linux Distros - An extensive collection of actively developed Linux distributions. | |
| Open Source Alternatives - Alternatives to software and services from Google, Microsoft, Apple, Adobe, IBM, Autodesk, Oracle and others. | |
| Essential Linux System Tools - Indispensable utilities for monitoring, maintaining and managing Linux systems. | |
| Linux Productivity Tools - Useful utilities for improving productivity and streamlining everyday tasks. | |
| Alternatives to Popular CLI Tools - Modern alternatives to familiar command-line utilities supplied with Linux systems. | |
| Awesome Free Linux Game Tools - Tools, utilities and companion software that improve gaming on Linux. | |
| Machine Learning on Linux - Machine learning and deep learning software, self-hosted applications and practical tools. | |
| Saving Money with Linux - Practical ways to reduce electricity consumption and lower computing costs with Linux. | |
| Linux Candy - Fun, entertaining and sometimes delightfully quirky software from the lighter side of Linux. | |

Please read our Comment Policy before commenting.