Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell script problem

Status
Not open for further replies.

piti

Technical User
Apr 12, 2001
627
SK
hi
i'm stuck and need some shell scripting expert
what i want to make is a script where i select data from my mysql database and for every returned record run another script with the record fields as arguments

i have that mysql part done:
mysql -u piti -ppiti -D testdb -e "SELECT IdCK, Preset FROM CKTbl WHERE IntOpen = 1 " -N -s

but the other one, run the second script, i'm not able to accomplish
any idea how to do that?
thanx
 
As I'm a bear of very little brain, I'd start by saving the output of the mysql bit into a text file - assuming 1 line per output record. Then, using you favourite scripting language (which I'll assume is Bash), open the text file as an array and use

foreach ($line @array){
/* Whatever code you want to run on each output line */
}

Okay, so this is perl, not bash, but there can't be that much difference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top