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                     │
╘═══════════════════╧═════════════════════╧════════════╧════════════════════════╛

Wrapped example.

╒════════════╤════════════════╤════════════╤═══════════════╕
│ Name       │ AMTRAK station │ City name  │ State or      │
│            │ code           │            │ district code │
├────────────┼────────────────┼────────────┼───────────────┤
│ Aberdeen   │ ABE            │ Aberdeen   │ MD            │
├────────────┼────────────────┼────────────┼───────────────┤
│ Albany     │ ALY            │ Albany     │ OR            │
├────────────┼────────────────┼────────────┼───────────────┤
│ Albany-    │ ALB            │ Rensselaer │ NY            │
│ Rensselaer │                │            │               │
├────────────┼────────────────┼────────────┼───────────────┤
│ 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.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tcatlib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43f92d9c9d43c8747a771f4ac1858136a9b2b93ce241f6310d0a30f0f6f46c53
MD5 eb56d6286c0630e6d19dc27fac045754
BLAKE2b-256 ee08137834473f860b64b3edd930f5e96f5f89d6ec43e23cf372fedf48aac55d

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