LinuxCommandLibrary

csvlook

Display CSV files in readable, tabular format

TLDR

View a CSV file

$ csvlook [data.csv]
copy

SYNOPSIS

csvlook [options] [FILE]

PARAMETERS

-d DELIM, --delimiter DELIM
    Set field delimiter (default: ,)

-t, --tabs
    Use tabs as delimiter

-q QUOTECHAR, --quotechar QUOTECHAR
    Set quote character (default: ")

-u, --unicode
    Force Unicode line drawing characters

-H, --no-header-row
    Input lacks a header row

--max-width N
    Maximum column width (default: 30)

-m N, --max-field-size N
    Maximum field display width (default: 100)

-l, --line-numbers
    Print line numbers

-h, --help
    Show help

--version
    Show version

DESCRIPTION

csvlook is a command-line tool from the csvkit suite designed to render CSV data in a human-readable, tabular format directly in the terminal. It automatically detects delimiters, quotes, and headers, then formats columns with proper alignment, borders, and truncation for overly long fields.

Ideal for quick inspection of CSV files without needing a spreadsheet application, it supports standard CSV variations including tab-delimited files. Users can customize output via options for delimiters, maximum column widths, Unicode rendering, and more. When no file is specified, it reads from standard input, making it perfect for piping data from other tools like grep or curl.

For example, viewing a large dataset becomes manageable with truncated fields and adjustable widths. It handles headers intelligently, using them as column titles, but can be told to skip them. Overall, csvlook excels at providing a spreadsheet-like preview for data analysis workflows in the shell.

CAVEATS

May truncate very wide tables; performance slows on extremely large files (>1GB). Requires csvkit installation via pip.

EXAMPLE

csvlook data.csv
Formats data.csv as a table.

curl -s url/to/api | csvlook
Pipes JSON/CSV API response to table view.

HISTORY

Developed as part of csvkit by Christopher Groskopf in 2010; now at version 2.x, widely used in data science pipelines for its simplicity and integration with Unix tools.

SEE ALSO

csvcut(1), csvstat(1), csvhead(1), column(1)

Copied to clipboard