Using Notepad++ Vertical Selection for Mass Changes

Notepad++ has a really cool feature that I’d like to share with those who haven’t already stumbled onto it. This feature is the ability to select vertically. The typical linear selection found in text editors works most of the time, but occasionally it is necessary to delete, copy or paste a column of text. To use the vertical selection feature, the user simply needs to press the “Alt” key.

One use case for this feature may be to grab some text from a show command, clean it up, and make some mass changes. Only as a demonstration, I’ll use the show interface command, remove unnecessary columns, and shut down the interfaces.

Below is the output of “show interface descriptions” from my home router.

NPPvirticalselect1

By pressing the “Alt” key as I select text, the behavior of the selection process changes. This allows for a vertical selection.

NPPvirticalselect2

As expected, pressing “Delete” will remove the text region. I could have also copied the text and pasted it into another area.

NPPvirticalselect3

As a bonus, I can create mass changes to what is left using find and replace. This feature in Notepad++ is very powerful and is perfect for this type of operation. Doing a regex search for “(.+)”, Notepad++ will find everything up to the “newline” characters. The parenthesis tells it to store the value in “$1”.

NPPvirticalselect4

By replacing the match with “interface $1 \r shutdown”, we now have text that we could cut and paste into a console to administratively shut down the interfaces.

NPPvirticalselect5

This is a very simple example that demonstrates a couple of powerful features. How could you use this in your workflow? What other features in Notepad++ makes your work life easier?

Comment your thoughts below.

No related content found.

About Paul Stewart, CCIE 26009 (Security)

Paul is a Network and Security Engineer, Trainer and Blogger who enjoys understanding how things really work. With over 15 years of experience in the technology industry, Paul has helped many organizations build, maintain and secure their networks and systems.
This entry was posted in How-To. Bookmark the permalink.

6 Responses to Using Notepad++ Vertical Selection for Mass Changes

  1. Jay says:

    Very helpful- Thanks for sharing

  2. Pingback: It’s the networks fault #12

  3. Jon Hartman says:

    Nice trick. Thanks for posting.

  4. Mat says:

    the compare plugin ! very useful to compare versions of configs

  5. gkprashu says:

    Thanks for the tip.

Comments are closed.