cut

Cuts binary flow records with dd.

usage: python3 -m flow_models.cut [-h] [-i {binary}] [-o {binary}] [-O OUTPUT]
                                  [--skip-in SKIP_IN] [--count-in COUNT_IN]
                                  in_files [in_files ...]

Positional Arguments

in_files

input files or directories

Named Arguments

-i, --in-format

Possible choices: binary

format of input files

Default: 'binary'

-o, --out-format

Possible choices: binary

format of output

Default: 'binary'

-O, --output

file or directory for output

Default: '-'

--skip-in

number of flows to skip at the beginning of input

Default: 0

--count-in

limit for number of flows to read from input

This tool can be used to cut flow records when both input and output are in binary formats. It is more efficient to use cut than the convert tool in such case, because flow records are not being serialized during the operation.

This tool uses the dd standard Unix command to cut binary flow record files in an efficient way.

A single binary file can be given as an input. In such case, a single output file should be specified with the parameter -O as an output.

In the case when multiple input files are specified, or the specified input is a directory, the output directory should be given with the parameter -O. Cut files will be created in that directory.

When no output is specified, the standard output (-) is being used. This is equivalent to reading the files sequentially with dd.

This tool does not perform flow records filtering, the –filter-expr parameter should not be specified.

Cutting of flow records can be done with skip_in, count_in parameters. They specify how many flow records should be skipped (skip_in) and then read (count_in) from input.

Example: (skips the first 100 records and writes the next 1000)

flow_models.cut -i binary -o binary -O sample –skip-in 100 –count-in 1000 sorted