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


I have a .txt file contain the following data,, 02:00:00:20:a2:10,, 02:00:00:20:a2:11,, 02:00:00:20:a2:12,, 02:00:00:20:a2:13

Note that the $5 "ip" must be exactly what the text file contains in this case, there may also be which I do not want changed.

From this data the table row contains 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


$3 = Always 19

$5 = First variable in text file

$6 = Third variable in text file

$7 = Always

$8 = Always

$9 = Always 24

OS Linux mysql 5.7

  • Database system and version?
    – J.D.
    Commented Jan 25, 2023 at 21:02
  • Ubuntu mysql 5.7
    – Toodarday
    Commented Jan 25, 2023 at 21:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.