Tricks with Notepad++

Notepad++ is an amazing text editor which not just gives you option to edit and save your text files, but also gives lot many features which can help you in doing magic.

Few of the useful options available are listed below. Experiment yourself and unveil the power of Notepad++

 

Remove all whitespace char’s

Select all the text you want to remove the white space chars and click ‘Cntrl+H’, type space in the find field and leave the Replace field blank. Click ‘Replace all’ to remove all the spaces in the text file.

Replace Whitespace

Replace Whitespace

Delete the first word/space/line no’s

TextFX > TextFX Tools > Delete Line Numbers or First word

Remove Line Numbers

Remove Line Numbers

Remove the trailing spaces

TextFX > TextFX Edit > Trim Trailing Spaces

Remove Blank Lines

TextFX > TextFX Edit > Delete Blank Lines
TextFX > TextFX Edit > Delete Surplus Blank Lines

Remove Blanks

Remove Blanks

Change Case of Selected Text

TextFX > TextFX Characters, the following options are available

  • UPPER CASE
  • lower case
  • Proper Case
  • Sentense case.
  • iNVERT cASE

Insert/Append Words in all the Lines

Prefix/Suffix Present

Consider an example that all the lines start with a prefix file_ (like file_my1.txt, file_my2.txt etc), the click ‘Cntrl+H’ and search for file_ and replace with new_prefix. This will result in a leading space character in all the lines, follow this section to remove that.

Prefix/Suffix not Present

Enter the prefix you want to add,say new_prefix, in the first row/column. Click ‘Cntrl’ and drag the small black rectangular box to the number of lines you want to add the prefix to (i.e if there are 10 lines drag till the 10th row). Copy the text from the text file and paste it in the second column. Now copy first and second rows and paste it back in the notepad++. If you find and space between the prefix and the previous text then follow this section to remove that.

Move Lines Up/Down

Select the line and click Cntrl+Shift+Up / Cntrl+Shift+Down for moving the line up/down respectively.

Move Lines

Move Lines

Update: (Check the comment)

To remove the ‘Newline’ characters

1. Click on the ‘Show All Characters’ Button in Notepad++ toolbar (Or View Menu – Show Symbol – Show All Chars)

Show All CharactersShow All Characters

2. Open the Replace Dialog box (Cntrl+H)

Replace NewlineReplace Newline

3. Select the ‘Extended Search Mode’

4. Search for ‘\n’ and enter nothing in the ‘Replace with’ field (Make sure that no spaces are entered there)

5. Search for ‘\r’ and repeat the above step

Info: Here, we are removing the Carriage Return and Line Feed characters which make any text editor identify and render the new lines. The position of CR and LF characters can be viewed by clicking the ‘Show all chars’ button.

 

Update 2: Request for Column editor tip, via Comment

Using Column Editor

Check the Video to see it in action below,

[youtube w=600 h=475]http://www.youtube.com/watch?v=1p7rMCGt_30&hd=1[/youtube]

 Update 3: Column-wise selection for large files, via comment (form Only333)

If the file size is huge, we can use  use Alt+Shift+Click to mark a start position, then scroll to end position and then again use Alt+Shift+Click to mark an end position. This will highlight the text and lets us do the required manipulation with the selected text.