| 1 | #!/usr/bin/env bash
|
| 2 | #
|
| 3 | # Usage:
|
| 4 | # ./tsv.sh <function name>
|
| 5 |
|
| 6 | set -o nounset
|
| 7 | set -o pipefail
|
| 8 | set -o errexit
|
| 9 |
|
| 10 | # https://www.stefaanlippens.net/pretty-csv.html
|
| 11 |
|
| 12 | # Features missing:
|
| 13 | # - right justification of numbers
|
| 14 | # - rounding numbers for eyeballing?
|
| 15 | # - changing width interactively?
|
| 16 | # - would be nice to have a cursor
|
| 17 | # - optional prettification
|
| 18 | # - column headings, maybe https://qtsv.org line
|
| 19 |
|
| 20 | pretty-tsv() {
|
| 21 | column -t -s $'\t' -n "$@" | less -F -S -X -K
|
| 22 | }
|
| 23 |
|
| 24 | demo() {
|
| 25 | pretty-tsv ../benchmark-data/compute/bubble_sort/*.tsv
|
| 26 | }
|
| 27 |
|
| 28 |
|
| 29 | # https://stackoverflow.com/questions/1875305/view-tabular-file-such-as-csv-from-command-line
|
| 30 | #
|
| 31 | # Others:
|
| 32 | # - csvtool
|
| 33 | # - csvkit with csvlook
|
| 34 | # - https://github.com/codechenx/tv
|
| 35 |
|
| 36 | "$@"
|