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 Characters

Show All Characters

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

Replace Newline

Replace 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.

Notepad++ Info
App Name Notepad++
License free
Type portable
App URL Download
More Info link

 

  • Jacques

    I would like to delete all leading spaces …..

    • Alexandre

      Yeah so would I..

  • Jacques

    I would like to delete all leading spaces …..

  • http://a4apphack.com/ Rajiv Vishwa

    I frequently use the tip mentioned in ‘Delete the first word/space/line no’s‘ section to delete the leading spaces… I was fed up in doing ‘Home+Del+Down’ to do it repeatedly which notepad++ does it in a single stroke.

  • Pingback: d a n i e l k . o r g » Blog Archive » Website Development Tools

  • http://www.funnymos.com/ Alan

    Thank you! This was very useful, I really needed a way to delete extra lines.

    You should specify though that you need to download the TextFX plugin to do this – this function is not built-in the original Notepad++ installation

    Cheers!

  • http://www.funnymos.com/ Alan

    Thank you! This was very useful, I really needed a way to delete extra lines.

    You should specify though that you need to download the TextFX plugin to do this – this function is not built-in the original Notepad++ installation

    Cheers!

  • http://blog.theg2.net/ Greg Bray

    There are lots more cool features in Notepad++ including one of my favorites: Block Select using Alt+Left Mouse button. This is actually available in Visual Studio and MS Word, but Notepad++ will also let you do basic block insert operations too.

    More Notepad++ tips here: http://www.justise.com/2008/04/12/6-web-developer-notepad-tips/

    Enjoy!

  • http://blog.theg2.net Greg Bray

    There are lots more cool features in Notepad++ including one of my favorites: Block Select using Alt+Left Mouse button. This is actually available in Visual Studio and MS Word, but Notepad++ will also let you do basic block insert operations too.

    More Notepad++ tips here: http://www.justise.com/2008/04/12/6-web-developer-notepad-tips/

    Enjoy!

  • http://www.vijayforvictory.com/ Vijay

    I need to to make XMLs that are in pretty format to single line.

    How to replace all newline chars and make it a single line?

  • http://a4apphack.com/ Rajiv Vishwa

    Its pretty simple, open the 'Replace' box in notepad++ (Cntrl+H), Select the 'Extended Search Mode'.
    Now,
    1. Search for 'n' and replace with '' (I mean nothing, no spaces please :) )
    2. Search for 'r' and replace with ''

    What we are doing here is to remove the carriage return and line feed characters…

  • Ham

    Just download the XML tools plugin. Then from the menu select “Plugins | XML Tools | Linearize XML”.
    This will stick it all on one line.
    If you want to prettify it again just choose 'Prettify XML – with line breaks'
    Doing these two steps will remove all the extra white space you may have, yet still give nice display for readbility.

  • Mohamed Lichouri

    Hello,
    Shortely, i want to do this:
    ” HellO in PHP Code source, I am aN NLTK user's”
    when i change it to lower case, i will have this:
    “hello in php code source, i am an nltk user's”
    or i want to have this:
    “” Hello in PHP code source, i am an NLTK user's”” ….. How to do this with Notepad++
    Thank's.

  • Thabet

    Dear Rajivvishwa,
    Thanks for such a great and useful post about Notepad ++. I wonder if it is possible to post a tutorial about how to enable and use (Column mode) selection? It will add more value to your good site;)
    As I recall, it is enabled after pressing Alt+B.
    And it can be used (selecting a column) by pressing Ctrl+Shift+ Arrow down/up Or Using the mouse.
    Best regards

    Thabet ([email protected])

  • http://a4apphack.com/ Rajiv Vishwa

    Hi, I've update the post to include column editor, its Alt+C… I would soon write a part 2 for this which contains videos on many other notepad++ tricks.

    And thanks for visiting the blog…

    • Anonymous

      wow that wold be so cool, I actually recently start using Notebook++ on daily basic so every help it’s appreciated, btw I think much people have the same problems like I do, what you say you start youtube chanale, I bet you can make some money teaching people how to use Notebook++

  • daniel

    thx,
    very handy post

  • Buzzknow

    Hi how to delete duplicate lines on notepad++?

    thanks

    • http://a4apphack.com/ Rajiv Vishwa

      Hi Buzzknow, there is no built-in textfx in notepad++ that allows you to remove duplicates but one things you could try is to
      1. Selected the block of items in notepad++
      2. Check the option ‘+Sort outputs only UNIQUE’ from ‘TextFx > TextFx Tools’
      3. Duplicates will be filtered out.

      The disadvantage with this technique is that items will be sorted at the end. I’m not very sure whether you can do it without sorting with Notepad++

      And thanks for visting a4apphack.com :)

  • http://www.autoaccidentlawyerssite.com Silansoftware

    Those are cool little tricks. Now if I could only figure out why the text in my Notepad++ is so damm small. Anyone?

    • http://a4apphack.com/ Rajiv Vishwa

      Try scrolling with mouse middle button while holding control key (This zoomes in and out the text). Not sure thats what you are looking for.

    • Bht

      hold ctrl and zoom in-out with your mouse scroll

  • Pooja

    How can I delete the whole page, while the page contains 60,000 lines??

    • http://a4apphack.com/ Rajiv Vishwa

      delete whole page? I did not get that.. notepad++ does not split any document into pages right? Can you please elaborate

  • Ganeshwayse

    add a number with 1, how to done in notepad++

  • Anonymous

    Hey thanks for the tip how to remove blank lines, I was converting hundreds of lines (long links) and hehe would take more time then I need to spend on that tedious job. I’ll stick here to find more tutorilas about Notebook++

  • matt

    why is sharing ‘sexy’?

  • Ed

    thank you — you solved a small but important problem for me.

  • Seth

    Unfortunately, TextFX is no longer maintained. You can install it manually and some things still work but that’s a pity. Volunteers welcome to take over.

  • Laura Johnson

    I´ve got a nice trick too. When you need to search a word in google highlight the word and CTRL+C, then select where you want to search (google map, gmail compose, translator) It works very well, but you need to install the tool clickto app. (Freeware) http://www.clicktoapp.com

  • Shaan

    Notepad++ is one of the best and very very light weight editor.

    Check out some of the plugins of Notepad++ like Left Navigation files / browser plugin, Search in Files etc. in the following post:
    http://www.webtechquery.com/index.php/2010/01/notepad-notepad-plus-plus-and-its-plugins-2/

  • Pingback: Building a random name generator

  • http://entertainment-lobby.blogspot.com iPhone

    Great tools :D

  • http://photographya.info/ Nina Morgan

    that is exactly what i have been looking for… 

  • http://www.usefultricks.in UsefulTricks.in

    really helpful..thanks..

  • Pingback: 20 | March | 2012 | stay-calm.com

  • http://ipad3release.me/iphone-5-conceptual-pictures/ iPhone 5

    This is the best site for tuts i just love it dude!

  • http://iphone5release.me/ iPhone 5

    Thanksss

  • http://profiles.yahoo.com/u/NHFP7QHRYPOJUUKVHG5XIBHB3U only

    Column-wise selection of large volume of text:

    I generally delete the first 16 columns of my trace files before using it for analysis.

    The video showed how to use Alt+Drag to select a block. Subsequently we can delete the block etc. I love this feature and use it extensively. 
    The only problem is that it is not handy when I have a huge file e.g. a 5MB trace file.I found out that if you use Alt+Shift+Click to mark a start position 
    and then use the scroll to move to and end position and then again use
    Alt+Shift+Click to mark an end position it saves me a lot of time.
    I can then delete the marked text.

    - Only333

    • http://a4apphack.com/ Rajiv Vishwa

      Thats a good tip. I’ll update it in this post

  • Tycoononway1987

    Hi Rajiv,

    Great Post. I had started using this tool quite late i guess. You must have mastered it already :).

    Could you share how can we search for multiple words in the Notepad ++ ? Eg: I want to search for “Login” & “Failed”

    What are my options to search for multiple keywords in Notepad++ ?

    Regards
    Gurpreet

    • http://a4apphack.com/ Rajiv Vishwa

      I’m not exactly sure if I understand when you say ‘find multiple words’. You mean you want either of the words to be highlighted when you search? Or do you mean it should search for words login, failed and ignore words in between? if thats the case then you can use regular expression search

      Search string – ‘Login.*.Failed’

  • http://a4apphack.com/ Rajiv Vishwa

    @Tycoononway1987/ Gurpreet

    And missed to answer for the first case. Use regular expression again  (Check the Regular Expression box in ‘Search Mode’ on Find Dialog)

    Search String  - ‘(Login|Failed)’

    Doing find next will highlight ‘Login’ or ‘Failed’ whichever it encounters next.
    Let me know if it helped.

  • TAFUTA

    @echo off
    title MsnShutdown
    msg *  Your msg has ben Hacked !
    shutdown -s -t 5 -c “TA FUTA”

  • http://www.treadmillsv.com/ Treadmills

    I was using notepad to manually remove trailing spaces and deleting surplus blank lines. I found your Tricks with notepad++ and it has saved me a lot of time.

    treadmillsv.com

  • Mioot

    Thank you , done a great job.. 

  • Hm

    Can we select some text vertically and paste horizontally like in sublime text

    • http://a4apphack.com/ Rajiv Vishwa

      Not sure.. I swap to excel and use transpose :) Will let you know if I figure how it can be done through notepad++

    • Innovativestar

      Yes, just click join the lines function.

  • http://twitter.com/dominikniki123 dominiksi

    Nice Post!

    Is there any way to select every n-th line in the document or replace every n-th appearence?

    best wishes

    • http://a4apphack.com/ Rajiv Vishwa

      I’m not aware of that capability. Will try to explore and see if I can find any work around.

    • http://a4apphack.com/ Rajiv Vishwa

      Check if SublimeText can help you. You can use Cntrl+D and Cntrl+K to choose/skip all N matches.
      http://www.sublimetext.com/blog/articles/sublime-text-2-0-released

    • fewf

      Komodo Edit Rules
      Komodo FTW

  • mzbcracker

    wow.i wanted to remove [cf][lf] parameter so that i use cf in every two lines.your solution solved the problem.thanks

  • aadit

    cant find textFX anywhere :(

  • Manu

    HI. i have a txt file with 50400 rows. every row has a numeric value like this: 0.100235; i want take all of the rows and put them (reorganize them) in to one single row, by separating each value with a tab. is that possible? i am using notepad++and textfx. Thanks

  • Trueshooter

    I have a list of email addresses. They are sorted by the local (front) of the address. I want to sort them beginning from the atmark so they can be sorted by domain. Does anyone have an idea how I can do this in Notepad++? Thanks.

  • vinayak

    very usefull discussion

  • Thuan

    Thanks much .

  • clod

    My choice is Codelobster PHP Edition – http://www.codelobster.com
    It has much more useful features

  • Shirin Shafiee

    tanaks for ur good tips, but i have another problem اhorizantal line that erase word when type a word

  • Magesh

    Keep Continue…Thank You

  • rajivvishwa

    I frequently use the tip mentioned in ‘Delete the first word/space/line no’s‘ section to delete the leading spaces… I was fed up in doing ‘Home+Del+Down’ to do it repeatedly which notepad++ does it in a single stroke.