24 Nov

Database Data to Download Variables

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