[bash] add function to display csv

This commit is contained in:
Julin S 2022-04-29 18:47:24 +05:30
parent 3d43c31715
commit 513425585a
1 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,16 @@
function csv {
# Format and display csv files in terminal
if [ $# -lt 1 ]; then
echo "Please specify file name"
elif [ -f $1 ]; then
# https://stackoverflow.com/questions/1875305/view-tabular-file-such-as-csv-from-command-line
column -s, -t < $1 | less -#2 -N -S
else
echo "$1: File not found"
#exit 1
fi
}
# Set primary prompt
PS1='fam@ubu:\w\$ '
@ -10,3 +23,4 @@ alias calsh='bash /home/calsh.sh'
alias sml='rlwrap sml'
alias ghci='rlwrap ghci'