Viewing
Rabbet provides several commands for viewing and inspecting data files in a formatted table view. These commands are useful for quickly examining your data without performing any transformations.
Commands Overview
cat
- Display the entire contents of a filehead
- Display the first N rows of a filetail
- Display the last N rows of a file
Basic Usage
rabbet cat <file>
rabbet head <file> [-n <number>]
rabbet tail <file> [-n <number>]
Common Options
All viewing commands support these options:
--format
: Output format -table
(default),csv
,json
, orjsonl
--delimiter
: Input file delimiter (default:,
)--no-header
: Treat the first row as data instead of column headers
Examples
Viewing Entire Files with cat
Display all rows from a CSV file in a formatted table:
Test cat command with table format output
$ rabbet cat data/orders/orders.csv
╭────────────────────────────────────────────────────────────────────────╮
│ order_id customer_id product_id quantity price order_date │
╞════════════════════════════════════════════════════════════════════════╡
│ ORDER-001 CUSTOMER-003 PRODUCT-005 1 10.0 2022-01-01 │
│ ORDER-002 CUSTOMER-003 PRODUCT-005 2 20.0 2022-01-02 │
│ ORDER-003 CUSTOMER-003 PRODUCT-003 3 30.0 2022-01-03 │
│ ORDER-004 CUSTOMER-004 PRODUCT-002 4 40.0 2022-01-04 │
│ ORDER-005 CUSTOMER-005 PRODUCT-001 5 50.0 2022-01-05 │
│ ORDER-006 CUSTOMER-006 PRODUCT-004 6 60.0 2022-01-06 │
╰────────────────────────────────────────────────────────────────────────╯
Viewing First Rows with head
Display the first 3 rows of a file:
Test head command with table format output
$ rabbet head data/orders/orders.csv -n 3
╭────────────────────────────────────────────────────────────────────────╮
│ order_id customer_id product_id quantity price order_date │
╞════════════════════════════════════════════════════════════════════════╡
│ ORDER-001 CUSTOMER-003 PRODUCT-005 1 10.0 2022-01-01 │
│ ORDER-002 CUSTOMER-003 PRODUCT-005 2 20.0 2022-01-02 │
│ ORDER-003 CUSTOMER-003 PRODUCT-003 3 30.0 2022-01-03 │
╰────────────────────────────────────────────────────────────────────────╯
Viewing Last Rows with tail
Display the last 3 rows of a file:
Test tail command with table format output
$ rabbet tail data/orders/orders.csv -n 3
╭────────────────────────────────────────────────────────────────────────╮
│ order_id customer_id product_id quantity price order_date │
╞════════════════════════════════════════════════════════════════════════╡
│ ORDER-004 CUSTOMER-004 PRODUCT-002 4 40.0 2022-01-04 │
│ ORDER-005 CUSTOMER-005 PRODUCT-001 5 50.0 2022-01-05 │
│ ORDER-006 CUSTOMER-006 PRODUCT-004 6 60.0 2022-01-06 │
╰────────────────────────────────────────────────────────────────────────╯
Use Cases
- Quick inspection: Use
cat
for small files to see all data at once - Preview large files: Use
head
to check the structure and first few rows - Check recent entries: Use
tail
to see the most recent records in time-series or log data - Verify headers: Use
head -n 1
to quickly check column names - Data validation: Combine with other formats (
--format csv
) to verify parsing
Notes
- The default number of rows for
head
andtail
is 10 when-n
is not specified - Table format automatically truncates long values for display
- For very wide tables, consider using
--format csv
for better readability - These commands preserve the original data types and formatting