Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer
    
Ooh, so close. The number needs to be repeated through the various sub-components. I'll edit the question to be a little clearer about what I want. – MBraedley Oct 18 '11 at 19:04

If you paste to excel a text in witch line contains tabs separators, you'll get a useful sheet; so:

  • replace space with TAB chars using extended search (replace "_" and "=" with "\t")
  • copy and paste to excel, renumber the column content
  • copy and paste back to notepad++
  • replace tab with "_" and restore the "=" column typing into a rectangular selection (ALT+mouse selection) 1 char width.
share|improve this answer
    
This probably does the trick, but it's just as much work as @GeminiDomino answer. The point of the question is to do one or two clicks after the column select. See this question for why your solution isn't so nice. – MBraedley Oct 19 '11 at 17:52

Lately i've used OpenOffice Calc (works in any spreadsheet actually - from Excel to Google Docs) to do this for me in a "looks dumb, but it works" way.

  1. In cells A1 and A2 added some numbers (1,2).

  2. In cell B1 created a "formula" like:

    ="Some filler part "&$A1&" here;"
    
  3. Drag-filled A1:A2 down to A31 to fill it as source column.

  4. Drag-filled B1 to B31 to fill it as output data.

    The result was 31 rows with strings like:

    Some filler part 1 here;
    Some filler part 2 here;
    Some filler part 3 here;
    ...
    Some filler part 31 here;

  5. Selected column B and copy-pasted it to Notepad++.

I prefer doing it this way, just because Excel/Calc doesn't need any external macros or anything to accomplish tasks of this kind.

share|improve this answer
    
Either I don't understand your answer, or you don't understand my question. I have the feeling that it's the latter. – MBraedley Mar 11 '15 at 10:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .