Quickly increment selected numbers in Notepad++

notepad

I'm working on a plain text configuration file that has a configuration key format of

<type name>_<#>_<Subcomponent name>=<value>

To be a little more clear, the configuration file refers to a group of computers, so the type name could be COMPUTER, and subcomponent name could be IP or PORT, for instance. So I have a block of keys for computer 1 and its subcomponents, a block for computer 2, etc throughout the file.

Adding a single new block of keys is relatively easy, but adding multiple blocks becomes a tedious column selecting exercise. Since the type name is the same length throughout the file, I want to be able to do a column select through all the numbers that need changing, and quickly increment them. I don't see anything in TextFX that will do this, which would be the obvious option. Is there another way to do this quickly and easily?

As a side note, I know I could write a Perl script to do this, but it'd be a little to indiscriminate as I don't want to increment all numbers, just a group of them.

Best Answer

You may have to do it in batches (if your number column isn't zero padded to a constant width) but you can use column-selection (just tested working as of notepad++ 5.9.3) to select just the numbers, then use Edit->Column Editor (Alt-C) to set your start and end numbers.

This may not be much help either, if your numbers are neither zero-padded nor ordered, but hopefully it will be some help.

Related Question