FCSV

Synopsis

HELP:   Fix-CSV: normalize dirty CSV to clean RFC-4180 UTF-8
TYPE:   OBJECT
SYNTAX: > flcl FCSV(INPUT['str'/STREAM/DUMMY...],EXCLUDE['str'...],OUTPUT='str'/STREAM/DUMMY,REMOVE,RENAME='str',ROWIN='str'/STREAM/DUMMY,ROWOUT='str'/STREAM/DUMMY,RULES(),COMMENT(),STYLE(),DETECT(),FALLOC(),LOGGING.{},MESSAGE(),NORUN)

Description

The FCSV command normalizes a dirty CSV file to clean RFC-4180 UTF-8 CSV. It accepts CSV files with inconsistent quoting, mixed line endings, encoding variations, comment lines, or non-standard delimiters and produces a standards-compliant UTF-8 output suitable for direct import into databases or analytics tools.

The input is auto-detected using the ROWDET CSV detector (DETCSV). A previously detected row specification can be supplied via ROWIN to skip re-detection. The detected or loaded specification can be saved via ROWOUT for reuse.

FCSV operates in three modes selected by the OUTPUT value:

NORMALIZE (OUTPUT=file.csv): convert input to clean RFC-4180 UTF-8 CSV output. LEARN (OUTPUT=DUMMY, ROWOUT=file.tab): detect schema and write it, no data output. CHECK (OUTPUT=DUMMY): validate the input pipeline and produce no output.

Key parameters:

INPUT: Path to the input CSV file. Reads from stdin if omitted. OUTPUT: Path to the normalized output CSV; DUMMY = learn or check mode [none]. NORUN: Parse and display parameters without executing any conversion [FALSE]. ROWIN: Load a previously detected row specification from this file. ROWOUT: Write the detected row specification to this file for reuse. REMOVE: Delete the INPUT file after successful processing [FALSE]. RENAME: Rename the OUTPUT file to this path after successful processing. LOGGING: Select the logging destination (file, :STDERR, :STDOUT, ...). MESSAGE: Select the types of messages to include in the log.

Example

   flcl FCSV INPUT=dirty.csv OUTPUT=clean.csv

Reads dirty.csv, auto-detects encoding, delimiter, quoting style, and line endings, then writes a clean RFC-4180 UTF-8 CSV to clean.csv.

Example

   flcl FCSV INPUT=dirty.csv OUTPUT=DUMMY ROWOUT=schema.tab

LEARN mode: detects the CSV schema and writes it to schema.tab without producing any data output. The saved schema can be passed to subsequent runs via ROWIN= to skip re-detection.

Example

   flcl FCSV INPUT=dirty.csv ROWIN=schema.tab OUTPUT=clean.csv

Uses a previously detected schema from schema.tab instead of running the auto-detector. Useful when processing a series of files with the same layout.

Example

   flcl FCSV INPUT=eu_data.csv OUTPUT=clean.csv RULES(SEPCHR=SEMICOLON HEADLN=ON)

Normalizes a European CSV that uses semicolon as separator and has a header row. RULES hints steer the detector when the default detection is ambiguous.

To display the syntax of the command, please use:

   flcl SYNTAX FCSV[.parameter[.parameter[...]]]

To get the help information for a specific parameter, please use:

   flcl HELP FCSV.parameter[.parameter[...]]

To read the manual page for a parameter, please use:

   flcl MANPAGE FCSV.parameter[.parameter[...]]

To generate the user manual for the command, please use:

   flcl GENDOCU FCSV=filename

Parameters can be set as arguments in the command line (directly or per file) or as properties taken from the corresponding property file.

Arguments