LinuxCommandLibrary

ffe

Find files by editing the find command

TLDR

Display all input data using the specified data configuration

$ ffe [[-c|--configuration]] [path/to/config.ffe] [path/to/input]
copy

Convert an input file to an output file in a new format
$ ffe --output=[path/to/output] [[-c|--configuration]] [path/to/config.ffe] [path/to/input]
copy

Select input structure and print format from definitions in ~/.fferc configuration file
$ ffe [[-s|--structure]] [structure] [[-p|--print]] [format] [path/to/input]
copy

Write only the selected fields
$ ffe [[-f|--field-list]] "[FirstName,LastName,Age]" [[-c|--configuration]] [path/to/config.ffe] [path/to/input]
copy

Write only the records that match an expression
$ ffe [[-e|--expression]] "[LastName=Smith]" [[-c|--configuration]] [path/to/config.ffe] [path/to/input]
copy

Display help
$ ffe [[-?|--help]]
copy

SYNOPSIS

ffe [options] [file …]

PARAMETERS

-d DELIM
    Set input field delimiter (default: tab)

-D DELIM
    Set output field delimiter (default: tab)

-f FIELDS
    Fields to extract (e.g., 1,3-5,name)

-F FORMAT
    Output format string with %N placeholders

-e ENCODING
    Input/output character encoding

-h
    Display help and exit

-i
    Ignore bad input records

-l
    Treat strings literally (no quoting)

-m MAX
    Process at most MAX records

-n
    Suppress header output

-o FILE
    Write output to FILE

-p PROG
    Use PROG file for transformations

-r
    Raw output (no quoting/escaping)

-s SKIP
    Skip first SKIP records

-t
    Table-aligned output

-u
    Output only unique records

-V
    Verbose mode

-v
    Display version

-x
    Hex dump input

-X
    Syntax check only, no output

DESCRIPTION

The ffe command, or Flat File Extractor, is a powerful tool for parsing, extracting, and reformatting fields from delimited flat files such as CSV, TSV, or custom-delimiter data. It excels at selecting specific columns by number or name, handling headers, skipping records, and outputting in various formats like tables or custom strings.

Key features include support for multiple input/output delimiters, character encodings (e.g., UTF-8, ISO-8859-1), field quoting, and programmable transformations via external scripts. It processes files line-by-line efficiently, making it suitable for large datasets without loading everything into memory. Users can ignore malformed records, enforce uniqueness, or perform syntax checks without output.

Common use cases: data cleanup, report generation, ETL pipelines, and converting between formats. Unlike cut or awk, ffe offers richer field selection (ranges, regex), header-aware processing, and built-in formatting, reducing the need for complex scripts.

CAVEATS

Not installed by default (install via package manager, e.g., apt install ffe); limited regex support compared to awk; stdin/stdout only for pipes.

FIELD SPECIFICATION

Fields via numbers (1-based), names (if header), ranges (1-5), or regex (re:pattern). E.g., -f 'name,age,re:^[A-Z]+'

EXAMPLE

ffe -d ',' -f 1,3 -D ' | ' data.csv
Extracts columns 1 and 3 from CSV, outputs space-pipe delimited.

HISTORY

Developed by Timo Savola starting in 2002; initial release 0.1.0 focused on basic extraction. Evolved to version 0.3.5 (2013) with encoding, quoting, and scripting support. Maintained sporadically for niche flat-file processing.

SEE ALSO

cut(1), awk(1), sed(1), csvkit(1)

Copied to clipboard