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 hashes)

Uploaded Python 3

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