Timeline for A script to take data from csv file and perform related operations in a database
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 14, 2016 at 4:09 | vote | accept | itp dusra | ||
| Jul 13, 2016 at 2:54 | comment | added | itp dusra | Before the while loop can I create a db link and inside the while loop can I use the follwing sql statement : update table_users set phonenumber = concat(prefix, phonenumber) | |
| Jul 13, 2016 at 2:45 | comment | added | DopeGhoti |
cut [...] | while read phonenum takes the output of cut and uses it as the input for the while loop. read phonenum will read the input into the variable phonenum. The script will generate SQL, which you can review onscreen by just running the script, or you can redirect into an .SQL file you can execute in an SQL client, or you can pipe the output of the script directly into your SQL client (e. g. ./script.sh /path/to/data.csv | mysql -uuser -ppasswd dbname).
|
|
| Jul 13, 2016 at 2:31 | comment | added | itp dusra | But I want the update to be made in the DB . Will this script do that ? | |
| Jul 13, 2016 at 2:27 | comment | added | itp dusra | Thanks a lot for your reply . What exactly is (while read phonenum) is doing? By phone num do you refer to the file name or column or line ? | |
| Jul 13, 2016 at 2:18 | history | answered | DopeGhoti | CC BY-SA 3.0 |