Gets data from a MySql database, splits the data into separate columns, then uses one column in a URL to download something – and uses other column to name the file thats downloaded
for i in (mysql -u root Project_Madapp -sNe 'SELECT CONCAT(id,",",name) AS yo FROM City WHERE type="actual"'); do parts=({i//,/ }); wget -O "{parts[1]}.csv" "http://localhost/student_allocation_csv.php?format=csv&city_id={parts[0]}"; done
for i in *; do mysql -u root -sNe “create database (basenamei ‘.sql’)”; mysql -u root (basenamei ‘.sql’) < $i; done
This will create the database – and then import the necessary data into it.