jsivak / tabview

Small python script to easily navigate and view CSV files from the command line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tabview

View a CSV file in a spreadsheet-like display.

Posted by Scott Hansen <firecat4153@gmail.com>

Original code forked from: http://www.amk.ca/files/simple/tabview.txt Contributed by A.M. Kuchling <amk@amk.ca>

The highlighted position is shown in the top-left corner of the screen; next to it are shown the contents of that cell.

Features:

  • Python 3.x
  • Spreadsheet-like view for easily visualizing tabular data
  • Vim-like navigation (h,j,k,l, g(top), G(bottom), 12G goto line 12, m - mark, ' - goto mark, etc.)
  • Toggle persistent header row
  • Sort ascending or descending by any column
  • Full-text search, n and p to cycle between search results
  • 'Enter' to view the full cell contents
  • F1 or ? for keybindings
  • Can also use from python command line to visualize any tabular data (e.g. list-of-lists)
  • See the screenshots directory for some pictures.

Requires:

Python 3+

Installation:

Usage:

  • From command line: tabview.py <filename>

  • From python command line to view an object:

    import tabview.tabview as t
    a = [["a","b","c"], ["d","e","f"]]
    t.view(a)
    
  • From python command line to view a file:

    import tabview.tabview as t
    data = t.process_file(filename)
    t.view(data)
    

Keybindings:

F1 or ? Show this list of keybindings
Cursor keys or h,j,k,l Move the highlighted cell, scrolling if required.
Q or q Quit
Home or ^ Move to the start of this line
End or $ Move to the end of this line
PgUp/PgDn or J/K Move a page up or down
H,L Page left or right
g Goto top of current column
[num]G Goto line <num> or bottom of current column if num not given
Insert or m Memorize this position
Delete or ' Return to memorized position (if any)
Enter View full cell contents in pop-up window.
/ Search
n Next search result
p Previous search result
t Toggle fixed header row
s Sort the table by the current column (ascending)
S Sort the table by the current column (descending)

About

Small python script to easily navigate and view CSV files from the command line

License:Other