-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpview
More file actions
executable file
·36 lines (32 loc) · 809 Bytes
/
pview
File metadata and controls
executable file
·36 lines (32 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# INSTALL: symlink or copy this file to /usr/local/bin
#
# Paginated command line viewer for column-based data
#
# Usage:
# $ pview [-s separator] filepath
#
# Positional Arguments:
# * filepath: Path to text data
#
# Options:
# * [-s separator]: Column separator token (default comma)
#
# Notes:
# Adapted from Stefaan Lippens
# https://www.stefaanlippens.net/pretty-csv.html
# Parse CLI optional and positional arguments --------------------------------
while getopts "s:" opt; do
case $opt in
s)
separator=\"$OPTARG\";;
\?)
exit 1;;
:)
exit 1;;
esac
done
separator=${separator:-","}
filepath=$1
# Execute command ------------------------------------------------------------
column -t -s";" -n "${filepath}" | less -FSXK