Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

matchy build

Build a database from input files.

Synopsis

matchy build [OPTIONS] <INPUT> --output <OUTPUT>

Description

The matchy build command reads entries from input files and builds an optimized binary database. The input can be CSV, JSON, JSONL, or TSV format.

Options

-o, --output <FILE>

Specify the output database file path.

$ matchy build threats.csv -o threats.mxy

--case-sensitive

Use case-sensitive string matching. By default, matching is case-insensitive.

$ matchy build domains.csv -o domains.mxy --case-sensitive

--format <FORMAT>

Explicitly specify input format: csv, json, jsonl, or tsv. If not specified, format is detected from file extension.

$ matchy build data.txt --format csv -o output.mxy

Examples

Build from CSV

$ cat threats.csv
key,threat_level,category
192.0.2.1,high,malware
10.0.0.0/8,medium,internal
*.evil.com,high,phishing

$ matchy build threats.csv -o threats.mxy
Building database from threats.csv
  Added 3 entries
Successfully wrote threats.mxy

Build from JSON Lines

$ cat data.jsonl
{"key": "192.0.2.1", "threat": "high"}
{"key": "*.malware.com", "category": "malware"}

$ matchy build data.jsonl -o database.mxy

Entry Type Detection

Matchy automatically detects entry types from the key format:

InputDetected As
192.0.2.1IP Address
10.0.0.0/8CIDR Range
*.example.comPattern (glob)
example.comExact String

Explicit Type Control

Use type prefixes to override auto-detection:

$ cat entries.txt
literal:*.not-a-glob.txt
glob:simple-string.com
ip:192.168.1.1

$ matchy build entries.txt -o output.mxy
PrefixTypeExample
literal:Exact Stringliteral:file*.txt matches only "file*.txt"
glob:Patternglob:test.com treated as pattern
ip:IP/CIDRip:10.0.0.1 forced as IP

The prefix is automatically stripped before storage. This is useful when:

  • String contains *, ?, or [ that should be literal
  • Forcing pattern matching for consistency
  • Disambiguating edge cases

See Entry Types - Prefix Technique for complete documentation.

See Also