Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csvbow project icon

csvbow

csvbow is a small Linux command-line viewer and filter for CSV, TSV, and similar delimited text. It parses records with Go's CSV parser, gives each column a consistent ANSI color in terminals, and keeps redirected output clean and machine-readable by default.

Build

make
make test
sudo make install

Or run directly:

go run ./cmd/csvbow --help

Usage

csvbow data.csv
cat data.csv | csvbow
zcat data.csv.gz | csvbow
csvbow -t data.csv
csvbow -g FAILED 'temp/Securities.202608*.csv'

When stdout is a terminal, columns are colored with the vivid palette. When stdout is redirected or piped, color is disabled and normal output is valid CSV:

csvbow -f STATUS -g FAILED data.csv > failed.csv

To keep color through a pager:

csvbow --color=always data.csv | less -RS

Filtering

csvbow -g ERROR data.csv
csvbow -f STATUS -g FAILED data.csv
csvbow -f HOST -E -g '^ldn[0-9]+' data.csv
csvbow -f STATUS -x -g FAILED data.csv
csvbow -ig failed data.csv
csvbow -f STATUS -g OK -v data.csv
csvbow -f STATUS -g FAILED -b 2 -a 3 data.csv
csvbow -f STATUS -g FAILED 'temp/Securities.202608*.csv'
csvbow -f STATUS -g FAILED --no-highlight data.csv

Field indexes are 1-based. If a header is present, fields can also be addressed by exact column name. With --ignore-case, column-name lookup and matching are case-insensitive.

When color is enabled, matching text is highlighted by default with a high-contrast background. Use --no-highlight to keep only the per-column rainbow coloring. Redirected output still stays clean CSV with no ANSI codes unless --color=always is used.

Use -b / --before-context and -a / --after-context to include nearby data rows around each match. Context rows are not counted by --head or --skip; those limits still apply to matching rows.

Multiple files and quoted globs are supported. When more than one file is read, output is prefixed like grep:

temp/Securities.20260801.csv:HOST,STATUS
temp/Securities.20260801.csv:server01,FAILED

Use --no-filename to suppress prefixes, or --with-filename to force them for a single file.

When grepping multiple files, files with no matching rows produce no output, including no repeated header.

Columns

csvbow -c 1,3,5 data.csv
csvbow -c HOST,STATUS,ERROR data.csv
csvbow -c NAME,3,STATUS data.csv
csvbow --exclude-columns PASSWORD,TOKEN data.csv

Requested columns are emitted in the requested order.

Delimiters And Headers

By default, csvbow samples the first records and chooses the most consistent delimiter from comma, semicolon, tab, pipe, and colon. Override it when needed:

csvbow -d ';' data.csv
csvbow --delimiter tab data.tsv
csvbow -d '\t' data.tsv

Header detection defaults to --header=auto. You can force behavior:

csvbow --header=yes data.csv
csvbow --header=no data.csv
csvbow --header=yes --print-header=no data.csv

Display

csvbow --palette soft data.csv
csvbow --palette pastel data.csv
csvbow --palette mono data.csv
csvbow --list-palettes
csvbow -t --max-width 40 data.csv
csvbow -n data.csv

Available palettes are vivid, soft, pastel, ansi, and mono.

Limits

Limits apply to data rows after filtering. Headers are not counted.

csvbow --head 20 data.csv
csvbow --skip 100 --head 20 data.csv
csvbow --tail 20 data.csv
csvbow -f STATUS -g FAILED --tail 10 data.csv

--tail stores only the last N matching rows. --head and --tail cannot be used together.

Inspection

csvbow --info data.csv
csvbow --fields data.csv

--info consumes the full input to count rows, so it is an inspection mode rather than a streaming display mode.

About

Rainbow CSV/TSV viewer and grep-style filter for terminals

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages