blog

SEAN K.H. LIAO

problem

Say you're using terraform with some poorly designed cloud thing, and you have a linked list of rules which also each needs their own index as an attribute cloudflare/terraform-provider-cloudflare#187. And now you have to insert an item somewhere close to the beginning of your 100 item chain. Do you go edit every number by hand?

(n)vim

:%s#priority = \(\d*\)#\=printf("priority = %d", submatch(1)+1)#

other search and replace stuff

one day I will read the entire manual, one day...