Tuesday, June 7, 2011

linux script loop and math

#!/bin/bash

for a in 0 1 2 3 4 5 6 7 8 9 10 11
do
let limit=$a*40000
api="select concat('\"',CAS,'\"',',','\"',Names,'\"') from webcas.cas_name where CAS REGEXP '[0-9]{2,7}-[0-9]{1,2}-[0-9]{1}' limit $limit, 40000;"
echo "$api"
mysql -u chem -ppw webcas -e "$api" > api.$a.csv
done

No comments:

Post a Comment