comma
Command 'comma' not a standard Linux command
TLDR
View documentation for the original command
SYNOPSIS
comma [OPTION...] [mapping]
PARAMETERS
-h, --help
display this help and exit
--version
output version information and exit
--delimiter=CHAR
set field delimiter (default: ,)
--quote=CHAR
set quote character (default: ")
--empty-as-zero
treat empty fields as zero
--fields=FIELDS
comma-separated list of input fields
--output-fields=FIELDS
comma-separated list of output fields
--header
expect and output header line
--sort
sort records by all fields
--precision=DIGITS
floating-point output precision
--trailing-delimiter
output trailing delimiter after last field
--line-number
add line number as first field
--flatten
flatten nested structures
DESCRIPTION
The comma command is a powerful Linux utility for serializing and deserializing data streams in CSV format. It excels in command-line pipelines, allowing users to define the structure of tabular data using a simple mapping syntax like field1=int32,field2=float64,time. This enables type-safe conversions, filtering, sorting, and transformation of data on the fly.
Comma reads from stdin or files, processes according to the specified mapping and options, and outputs to stdout. It supports both text CSV input/output and binary formats, making it ideal for high-performance scientific computing, robotics, and data processing workflows. For example, it can convert numeric CSV to binary for efficient storage or vice versa.
Key strengths include precise field selection with --fields and --output-fields, handling of headers, quoting, delimiters, and special types like time (nanoseconds since epoch). It automatically infers missing values and supports sorting without loading entire datasets into memory. Widely used in projects requiring robust stream processing, comma bridges simple CSV handling with advanced data manipulation.
CAVEATS
Requires explicit mapping for typed processing; large datasets may need careful memory management with --sort. Not for interactive use.
MAPPING SYNTAX
Specify structure as field=type[,field=type...]. Types: int8,uint16,float32,double,time, etc.
Ex: comma x=float,y=float,time
EXAMPLE USAGE
Convert CSV to binary: cat data.csv | comma x,y | gzip > data.csv.gz
Filter fields: comma --fields=x,y,z input.csv
HISTORY
Developed by Peter Mitrano around 2010 as part of the Comma library for robotics and scientific data pipelines, particularly in ROS ecosystems. Evolved for efficient stream processing; stable since version 2.x.


