Vim search and replace examples

From V.S.V., Inc.
Jump to: navigation, search

Column swap for TinyDNS

I occasionally will get work tickets from clients that require some translation from what they want to what they need. Recently I got a large DNS request formatted like:

address -> name

and needed to format it into the TinyDNS style

=<name>:address:TTL:timestamp:view

So, I came up with:

:%s/^\(.*\) -> \(.*\)/=\2:\1:3600:40000000536c1a80:IN/g