From 513425585a1f0df3b890dde492c164d327060350 Mon Sep 17 00:00:00 2001 From: Julin S Date: Fri, 29 Apr 2022 18:47:24 +0530 Subject: [PATCH] [bash] add function to display csv --- bash/.bashrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bash/.bashrc b/bash/.bashrc index 4d185c2..e1e6ac0 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -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' +