Skip to content

Instantly share code, notes, and snippets.

@m3nd3s
Created March 12, 2018 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m3nd3s/886b422ee359f4f3b759bab9c1490b40 to your computer and use it in GitHub Desktop.
Save m3nd3s/886b422ee359f4f3b759bab9c1490b40 to your computer and use it in GitHub Desktop.
Console Pretty CSV
#!/bin/bash
PATH=$PATH:/usr/bin:/bin:/usr/local/bin
while [ "$1" != "" ]; do
case $1 in
-s ) shift
SEPARATOR=$1
;;
* ) FILEPATH=$1
esac
shift
done
SEPARATOR=${SEPARATOR:-,}
cat $FILEPATH | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s "${SEPARATOR}" | less -S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment