keep-header
preserves the first line of a file while passing the remaining lines through
TLDR
SYNOPSIS
keep-header [file...] -- command [args...]
DESCRIPTION
keep-header executes a command against one or more files in a header-aware fashion. The first line of each file is treated as a header. The first header is written unchanged, the remaining lines are sent to the command on standard input (header lines of subsequent files are dropped), and the command's output is appended after the header.A double dash (--) separates the input files from the command, much like a pipe. It is especially useful with commands that reorder or filter lines, such as sort, shuf, grep, awk or tail, when processing TSV or CSV files.
PARAMETERS
--h, --help
Print help.--V, --version
Print version information and exit.
CAVEATS
Only the command directly after -- receives the header-less data; a shell pipe placed after it applies to the whole output, header included. Wrap multi-command pipelines in sh -c. Does not work on CSV files whose header contains embedded newlines.
HISTORY
keep-header is part of eBay's TSV Utilities, a toolkit written in D by Jon Degenhardt. The project has seen no new releases since 2021.
SEE ALSO
tsv-filter(1), head(1), tail(1), sort(1), mlr(1)
