Skip to content

Reads a simple .CSV file and allows you to do operations on it

Notifications You must be signed in to change notification settings

thepsauce/tabular

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tabular

Reads a simple .CSV file and allows you to do operations on it

image

Running the example

Acquiring the source

git clone https://github.com/thepsauce/tabular.git
cd tabular

Building

./build.sh

Now you have these options

Show usage:

  • ./tabular

Print the whole file column by column:

  • ./tabular example.csv --all --print

Print the "Kiwi" column:

  • ./tabular example.csv --all --set-row Kiwi --print

View the table in a TUI:

  • ./tabular example.csv --all --view

View all columns matching "Product*":

  • ./tabular example.csv --all --set-column "Product*" --view

View the table and make operations, write it to a file after quitting:

  • ./tabular example.csv --all --set-column "Product*" --view --output output.csv

Append a row:

  • ./tabular example.csv --append "i;am;new;here" --all --output append.csv

Tabular uses getopt, the above can be written as:

  • ./tabular example.csv -d"i;am;new;here" -aoappend.csv

Append a column:

  • ./tabular example.csv --append-column Value --all --output append_column.csv

Note: This does not show all options, just the most interesting ones.

The --view option

This option gives you a TUI interface to interact with the table. It is a mode editor, you have three modes: Normal, Insert, Command.

Normal mode

ARROW KEYS hjkl Move the cursor
HOME 0 Move the cursor to the first column
END $ Move the cursor to the last column
g/G Move the cursor to the first/last row
TAB SPACE Move to the next cell
BTAB BACKSPACE Move to the previous cell
d Delete the current row
x Delete the current column
A Append an empty row
u Undo
CTRL+R Redo
> Increase the column width
< Decrease the column width
r Update all column widths
i Go to insert mode
: Go to command mode
Q Quit

Insert mode

LEFT RIGHT Move the cursor in the input field
BACKSPACE Delete previous character
DEL Delete character
CTRL+U Delete line
HOME Go to the beginning of the line
END Go to the end of the line
ENTER Update the cell
ESC Return to normal mode

Command mode

Same as insert mode but pressing enter will run the command, these are all commands:

  • i[nfo], p[rint], w[rite] (output), r[ead] (input)
  • all [A], all-rows [Ar], all-cols [Ac]
  • invert [I], invert-rows [Ir], invert-cols [Ic]
  • none [N], no-rows [Nr], no-cols [Nc]
  • r[ow], c[ol], set-row [sr], set-col [sc]
  • a[ppend], append-col [ac]
  • undo [U], redo [R]
  • q[uit]

They have a one to one correspondence to the program options.

About

Reads a simple .CSV file and allows you to do operations on it

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published