Reads a simple .CSV file and allows you to do operations on it
git clone https://github.com/thepsauce/tabular.git
cd tabular
./build.sh
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.
This option gives you a TUI interface to interact with the table. It is a mode editor, you have three modes: Normal, Insert, Command.
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 |
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 |
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.