Skip to main content

tcat utility

Project description

tcat

tcat is an extremely simple command-line tool for peeking at tabular data in the terminal.

It works like cat, but it

  • will always try to render consistently delimited data files with aligned/straightened columns
  • does word wrapping if necessary to try to fit the whole table inside the given terminal's width
  • works with tabs and commas
  • accepts standard input as an alternative to a file by filename

Install locally

./install_locally.sh

Install from PyPI

pip install tcatlib

Examples

A whole file.

tcat sample_data/amtrak_station_info.tsv

...

│ Worcester                             WOR                  Worcester             MA                     │
├──────────────────────────────────────┼─────────────────────┼──────────────────────┼────────────────────────┤
│ Yazoo City                            YAZ                  Yazoo City            MS                     │
├──────────────────────────────────────┼─────────────────────┼──────────────────────┼────────────────────────┤
│ Yemassee                              YEM                  Yemassee              SC                     │
├──────────────────────────────────────┼─────────────────────┼──────────────────────┼────────────────────────┤
│ Yonkers                               YNY                  Yonkers               NY                     │
├──────────────────────────────────────┼─────────────────────┼──────────────────────┼────────────────────────┤
│ Yuma                                  YUM                  Yuma                  AZ                     │
╘══════════════════════════════════════╧═════════════════════╧══════════════════════╧════════════════════════╛

A snippet sent to standard input.

head -n5 sample_data/amtrak_station_info.tsv | tcat

╒═══════════════════╤═════════════════════╤════════════╤════════════════════════╕
│ Name               AMTRAK station code  City name   State or district code │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Aberdeen           ABE                  Aberdeen    MD                     │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Albany             ALY                  Albany      OR                     │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Albany-Rensselaer  ALB                  Rensselaer  NY                     │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Albion             ALI                  Albion      MI                     │
╘═══════════════════╧═════════════════════╧════════════╧════════════════════════╛

Comma delimiter.

head -n5 sample_data/amtrak_station_info.csv | tcat

╒═══════════════════╤═════════════════════╤════════════╤════════════════════════╕
│ Name               AMTRAK station code  City name   State or district code │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Aberdeen           ABE                  Aberdeen    MD                     │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Albany             ALY                  Albany      OR                     │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Albany-Rensselaer  ALB                  Rensselaer  NY                     │
├───────────────────┼─────────────────────┼────────────┼────────────────────────┤
│ Albion             ALI                  Albion      MI                     │
╘═══════════════════╧═════════════════════╧════════════╧════════════════════════╛

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tcatlib-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file tcatlib-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tcatlib-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tcatlib-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cd3911c48752c5e45551f42f7d8ec17059df38253e73fe77903d54a737da87c
MD5 fbcae7db92b67182d0300d21007270d5
BLAKE2b-256 ef8aba23d93c9457965515b14726fdfb8ef028890d9026f5e2ef7a8fb0585a11

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page