73

I have the following data in a text file

p=1
p=1
p=1
p=1

etc. I open that file in Notepad++.

How would I change it to

p=1
p=2
p=3
p=4

etc.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
Ehsan Mohammadi
  • 833
  • 1
  • 6
  • 5
  • I guess I understand what you mean but I don't think it's a job for regex. You would better use a script for doing this kind of replacement. – Toto Oct 03 '14 at 11:39

1 Answers1

147

You can use the "Column Editor" mode. First, select the column you want by holding Alt and dragging down the column. Then go to "Edit->Column Editor", you will get a box that looks like this:

enter image description here

Choose the "Number to Insert" button, then choose the starting value and the increment. It will replace the column with the values you want.

darthbith
  • 18,484
  • 9
  • 60
  • 76
  • 9
    For keyboardists column selection is done with Shift + Alt + arrow keys. You can select a zero width column to insert data, e.g. numbering a list. https://notepad-plus-plus.org/features/column-mode-editing.html – Giles Roberts Oct 15 '16 at 18:38
  • 6
    And, at least as of Notepad++ 7.5.9, you can bring up the Column Editor pop up with Alt-C. – DDay Dec 18 '18 at 22:00
  • 2
    This pads to the right of the numbers to match right shift of larger numbers. I used an [online script](https://www.browserling.com/tools/number-lines) instead. – Cyrille Jan 23 '19 at 13:37
  • 1
    Do you why this doesn't work for me? Maybe I select wrongly? – Suncatcher Apr 02 '20 at 13:45
  • Leave the **repeat** text input box for latest notepad++ versions .. – Monster Brain May 31 '21 at 08:58