Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #create csv file
- wget "https://randomuser.me/api/?results=100&format=csv" -qO /tmp/peoplecsv/people.csv
- #create database
- sqlite3 people.sqlite
- #set mode and import CSV - note that first line will be field names
- .mode csv
- .import people.csv people
- #check things where imported correctly
- PRAGMA table_info(people);
- select * from people;
- #######Export to CSV######
- #export single table
- sqlite3 -header -csv people.sqlite "select * from people;" > output.csv
- #if you have more than one table, you can select which table you want with fzf
- table="$(sqlite3 people.sqlite ".tables"|tr " " "\n"|sort -u|fzf)"
- sqlite3 -header -csv people.sqlite "select * from $table;"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement