Nov 5, 2017

Create MySQL table from CSV file header

$ cat

# pass in the file name as an argument: ./ filename.csv
echo "create table $1 ( "
head -1 $1 | sed -e 's/,/ varchar(255),\n/g'
echo " varchar(255) );"

csvkit is a suite of utilities for converting to and working with CSV, the king of tabular file formats. csvkit is to tabular data what the standard Unix text processing suite (grep, sed, cut, sort) is to text. 

Featured Post

Setup Chinese Input Method in Ubuntu 17.10 Artful

sudo apt install ibus-sunpinyin After either of those commands do not forget to restart the IBus daemon ibus restart You might need t...