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.
By pressing the “Alt” key as I select text, the behavior of the selection process changes. This allows for a vertical selection.
As expected, pressing “Delete” will remove the text region. I could have also copied the text and pasted it into another area.
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”.
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.
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.