while read merchant_id address1 address2 city state postal_code code name
do
echo `mysqal -uxxxx -hxxxxxxxxxxxxxxxxxxx merchant_staging -e
"select id from pickup_locations where merchant_id ='$merchant_id' and address1 = '$address1' and postal_code = '$postal_code' and name = '$name'"| grep -v id` >> mer1
echo ":" >>mer1
done < merchantadd.txt
答案 0 :(得分:0)
while read merchant_id address1 address2 city state postal_code code name
do
echo `mysql -uxxx -hxxxxxxxxxxx merchant_staging -e "select id from pickup_locations where merchant_id ='$merchant_id' and address1 = '$address1' and postal_code = '$postal_code' and name = '$name'" | grep -v id` >> mer1
echo ":" >>mer1
done < merchantadd.txt
read m1 < mer1
while read code
echo `mysql -uxxx -hxxxxxxxxxx facilities -e
"insert into service_areas (type,type_id,value,code,active,updated_at,created_at) values ('pickupLocationMapping','$m1','pickupLocationMapping','$code',1,now(),now());"`
echo "No:of row's requested in Service_areas got created"
done < vendorpc.txt