Step 2 of 2

Mass edit a data file

Mass edit a data file

This server table was edited by hand, badly. Make it match the target shown in the panel below the prose, exactly — same lines, same order, one server per line.

What’s wrong with the buffer, top to bottom:

  • four host values are wrapped in single quotes instead of double quotes
  • two host values have no quotes at all
  • every server reads enabled = false and should read enabled = true
  • three servers are marked retired = true and their lines should go

Every fault repeats, so a fix that works for one should be made to work for all of them at once, or be repeated cheaply. If a step has you stuck, lesson 9 covers search and moving between matches, lesson 10 the surround commands, and lesson 11 one cursor per match and per line. Undo is always there if a change goes wrong.

  1. Make the file match the target
Make the file match the target
[servers]
alpha = { host = "alpha.lan", port = 8080, enabled = true }
bravo = { host = "bravo.lan", port = 8081, enabled = true }
echo = { host = "echo.lan", port = 8083, enabled = true }
golf = { host = "golf.lan", port = 8084, enabled = true }
hotel = { host = "hotel.lan", port = 8085, enabled = true }
india = { host = "india.lan", port = 8086, enabled = true }
lima = { host = "lima.lan", port = 8088, enabled = true }
mike = { host = "mike.lan", port = 8089, enabled = true }
oscar = { host = "oscar.lan", port = 8090, enabled = true }
papa = { host = "papa.lan", port = 8091, enabled = true }
romeo = { host = "romeo.lan", port = 8092, enabled = true }
tango = { host = "tango.lan", port = 8094, enabled = true }
victor = { host = "victor.lan", port = 8095, enabled = true }
whisky = { host = "whisky.lan", port = 8096, enabled = true }
yankee = { host = "yankee.lan", port = 8097, enabled = true }

Last one — goal check runs when it's done

Loading editor…