Pregunta

I have multiple lines in a bind dns file zone with the same ip address. I need to replace that ip address and add a line below with another A record like this:

mail   IN    A    10.10.10.10
ftp    IN    A    10.10.10.10

After changes it should look like:

mail   IN    A    11.11.11.11
       IN    A    11.11.11.12
ftp    IN    A    11.11.11.11
       IN    A    11.11.11.12

Thanks.

¿Fue útil?

Solución

To get the result you want, I would do this:

  1. Do a global substitute on the ip addresses:
    :%s/0/1/g

  2. Do some macro-like action on the lines in question with the "global" command:
    :g/\v(mail|ftp)/normal yypviwr $r2

    This duplicates every line containing "mail" or "ftp", replaces the first word of the new line with spaces and finally, replaces its last char with "2".

See :h :g for more help on the "global" command.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top