Skip to content

Instantly share code, notes, and snippets.

Last active January 1, 2023 23:09
What would you like to do?
Convert a CSV file to a Markdown table using SQLite3
#remove old output fiile
rm -f outputFile
#SQLite3 commands
cmd=$({ grep -v '^#' <<EOF
.headers on
.mode csv
drop table if exists temp_csvFile;
.import $1 temp_csvFile
.mode markdown
.headers on
.output $outputFile
select * from temp_csvFile;
#Pipe commands to temporary database
echo -e "$cmd" | sqlite3 ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment