My database table named VmIpAddress has the following 12 columns
id, hosting_id, server_id, vm_id, ip, mac_address, subnet_mask, gateway, cidr, trunks, tag, net
A row might contain for example
"3471","3654","16",NULL,"137.74.189.22","02:00:00:55:a1:57","255.255.255.224","137.74.189.254","27",NULL,NULL,"net0"
I have a .txt file contain the following data
137.74.189.22, 193.15.125.110, 02:00:00:20:a2:10
137.74.189.23, 193.15.125.111, 02:00:00:20:a2:11
137.74.189.24, 193.15.125.112, 02:00:00:20:a2:12
137.74.189.25, 193.15.125.113, 02:00:00:20:a2:13
Note that the $5 "ip" must be exactly what the text file contains 137.74.189.22 in this case, there may also be 137.74.189.222 which I do not want changed.
From this data the table row contains 137.74.189.22 should be modified to the new IP address and MAC as well as a few other columns $3 $5 $6 $7 $8 $9 should be changed so that it changes to
"3471","3654","19",NULL,"193.15.125.110","02:00:00:20:a2:10","255.255.255.0","193.15.125.1","24",NULL,NULL,"net0"
$3 = Always 19
$5 = First variable in text file
$6 = Third variable in text file
$7 = Always 255.255.255.0
$8 = Always 193.15.125.1
$9 = Always 24
OS Linux mysql 5.7