kmrfsplit.py

NAME
SYNOPSIS
DESCRIPTION
OPTIONS

NAME

kmrfsplit.py − split a file

SYNOPSIS

kmrfsplit.py [-n num] [-s pattern] [-d outdir] [-p prefix] [-f] file

DESCRIPTION

kmrfsplit.py splits a file into a number of files (-n) with roughly equal sizes. It assumes an input file consists of many records started by a string matching to a given pattern. When a pattern is not found in a certain range in the input file (around the split point), an error will be reported.

When outdir (-d) is specified, output files are saved under the directory. By default, output files have names "partX" and saved in the current directory, where X is a six-digit sequence number starting from 0 with some leading zeros.

OPTIONS

The following options are supported:

-n num

Specifies the number to split. Default is 1.

-s pattern

Specifies a pattern string of a record separator. A line matching to this pattern starts a new record. It accepts regular expressions. Default is "\n".

-d outdir

Specifies an output directory. Output files are saved under it. Default is the currrent directory.

-p prefix

Specifies a prefix to output file names. File names are suffixed by a number. Default is "part".

-f

Forces to create an output directory if it does not exist.