Files
gists/csv_cols
2017-09-18 11:47:26 +02:00

13 lines
204 B
Bash
Executable File

#!/bin/bash
#check if comma or semicolon
if [[ $( grep -c ',' $1 ) -gt $( grep -c ';' $1 ) ]]
then
delim=','
else
delim=';'
fi
#get headings and display them
head -n1 $1 | tr "$delim" "\n" | nl