csplit

Source: Wikipedia, the free encyclopedia.
csplit
Cross-platform
TypeCommand
LicenseGNU GPL v3

The csplit command in Unix and Unix-like operating systems is a utility that is used to split a file into two or more smaller files determined by context lines.

History

csplit is part of the

Single Unix Specification.[1] It first appeared in PWB UNIX.[2]

The version of csplit bundled in

coreutils was written by Stuart Kemp and David MacKenzie.[3] The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[4]

Usage

The command-syntax is:

csplit [OPTION]... FILE PATTERN...

The patterns may be

standard output
.

The optional parameters modify the behaviour of the program in various ways. For example, the default prefix string (xx) and number of digits (2) in the output filenames can be changed.

As with most Unix utilities, a

return code
of 0 indicates success, while nonzero values indicate failure.

Comparison to split

The split command also splits a file into pieces, except that all the pieces are of a fixed size (measured in lines or bytes).

See also

References

  1. The Single UNIX Specification, Version 4 from The Open Group
  2. ^ csplit(1) – FreeBSD General Commands Manual
  3. ^ "Csplit(1) - Linux man page".
  4. ^ "Native Win32 ports of some GNU utilities". unxutils.sourceforge.net.

Further reading

  • Ellen Siever, Aaron Weber, Stephen Figgins, Robert Love, Arnold Robbins, et al. Linux in a Nutshell, 5th Edition. O'Reilly Media: July 2005. .

External links

  • csplit: split files based on context – Shell and Utilities Reference,
    The Single UNIX Specification, Version 4 from The Open Group
This page is based on the copyrighted Wikipedia article: Csplit. Articles is available under the CC BY-SA 3.0 license; additional terms may apply.Privacy Policy