csvlook
Display CSV files in readable, tabular format
TLDR
View a CSV file
SYNOPSIS
csvlook [OPTIONS] [FILE]
PARAMETERS
-H, --no-header-row
Suppresses the output of the header row, displaying only data rows.
-y, --linenumbers
Adds a column displaying row numbers as the first column of the output table.
-p, --pretty-output
Enables or disables enhanced output formatting, including colors and Unicode box characters for borders. This is typically enabled by default.
--width N
Sets the maximum column width for displayed data to N characters, truncating content if necessary.
-d DELIMITER, --delimiter DELIMITER
Specifies the single-character string used to separate fields in the input CSV file. Defaults to comma.
-t, --tabs
A shorthand for setting the input delimiter to a tab character, assuming the input is tab-separated.
-q QUOTECHAR, --quotechar QUOTECHAR
Specifies the character used to quote fields in the input CSV file. Defaults to a double quote.
-u {0,1,2,3}, --quoting {0,1,2,3}
Controls the quoting behavior for output, corresponding to different CSV module constants (e.g., 0 for QUOTE_MINIMAL, 1 for QUOTE_ALL).
-b, --doublequote
Forces double quoting of all fields when writing, even if not necessary.
-e ENCODING, --encoding ENCODING
Specifies the character encoding of the input CSV file (e.g., 'utf-8', 'latin-1').
-L, --skipinitialspace
Ignores whitespace immediately following the delimiter in the input.
-z SNIFFLIMIT, --snifflimit SNIFFLIMIT
Limits the number of rows to sniff when inferring CSV dialect and column types from the input.
-I, --no-inference
Disables automatic type inference for columns, treating all data as strings for display.
-c COLUMNS, --columns COLUMNS
Specifies a comma-separated list of column names or 0-based indices to include in the output.
-C COLUMNS, --not-columns COLUMNS
Specifies a comma-separated list of column names or 0-based indices to exclude from the output.
-r, --reverse
Reverses the order of the data rows in the output table.
DESCRIPTION
csvlook is a utility from the csvkit suite of command-line tools, designed to make CSV (Comma Separated Values) files human-readable directly in your terminal.
It transforms raw CSV data into a well-formatted, aligned, and often colorful table, complete with borders and header rows. This command is invaluable for quickly inspecting data, debugging scripts, or exploring datasets without needing a spreadsheet application. It can read CSV data from standard input or a specified file. csvlook leverages csvkit's robust parsing capabilities, which can handle various CSV dialects, delimiters, and encodings, making it a flexible tool for diverse data sources.
CAVEATS
While highly convenient, csvlook has some limitations.
For extremely wide CSVs, the output may still exceed typical terminal width, requiring horizontal scrolling or manual truncation with --width, which can hide valuable data.
Processing and rendering extremely large datasets can be slower compared to simply viewing the raw text.
The correct display of Unicode characters and colors in the output depends on the capabilities and proper configuration of the terminal emulator and its fonts.
<B>PIPING CAPABILITIES</B>
csvlook is designed to integrate seamlessly into Unix-like pipelines. Data can be piped directly into csvlook from other commands (e.g., curl example.com/data.csv | csvlook), or its formatted output can be piped to other tools like less for paginated viewing of large tables.
<B>DEFAULT FORMATTING</B>
By default, csvlook attempts to provide the most aesthetically pleasing output. This includes intelligent column width adjustments, automatic type inference for numeric and date values (which can influence display), and colored output for improved readability, provided the terminal supports it. This default behavior usually offers a good balance between readability and information density.
HISTORY
csvlook is an integral part of the csvkit library, an open-source suite of command-line tools designed for processing CSV data.
It was initially developed by Christopher Groskopf and publicly released around 2012. The project's goal was to provide a more robust, Python-based alternative to traditional shell utilities (like cut, awk, grep) for common CSV tasks, particularly aimed at data journalists and analysts.
Since its inception, csvkit, and by extension csvlook, has become a popular choice for quick and reliable CSV manipulation in command-line environments due to its ease of use, powerful parsing capabilities, and user-friendly output.