find replace text in files.png

Notepad++ has been a long time favorite app of mine when it comes to text editors. It seems to have the right mix of features, and if you use it enough you’ll start coming across some gems that can really save time. One of the features I want to focus on here is the “Find in Files” functionality that is extremely easy to overlook.

To get to the Find in Files section all you have to do is open up the find/replace dialog and switch to the respective tab (pictured in the screenshot above). Most people I talk to about this feature say that they’ve never even navigated to that tab because the Find and Replace tabs generally conquer all of their bulk editing needs. It’s true that those tabs have a lot of functionality, but Find in Files definitely deserves the space it occupies.

When switching to the Find in Files tab you may not immediately notice how this is different than the Find tab. The Filters and Directory fields (along with a few of the checkboxes) are the notable differences. This is where you can specify a directory you want Notepad++ to crawl and bulk edit files without having to first open them in Notepad++. Using the filters you can have it restrict results to certain file extensions, and the checkboxes off to the side will control its ability to crawl into hidden folders and sub-folders.

I’d like to present you with a small warning though. Before doing a bulk replace you should perform a Find All so that you can see a list of matching files along with the line numbers that will be modified:

notepad bulk find.png

Why? Once you choose the Replace in Files option you’ll see a brief warning confirming that this is what you want to do, and then it will go on its merry way updating all matching files. No backups are made, and it won’t tell you which files were changed. Personally I think it should also return a list of all the files it modified along with a glance of the text before/after the change, but that’s just me.

Generally I just use this for the finding capabilities, which also has one other nifty aspect I haven’t mentioned yet. You can actually double-click on any line number in the result list to instantly have Notepad++ open that file and take you to that line number. Alternatively you can right-click in the result pane and select the Open All option to have all of the matching files opened in different tabs.

I have some other Notepad++ tips that I’ll be sharing later on… so be on the lookout if you enjoyed this article.

Notepad++ Homepage (Windows only; Freeware)

There Are 8 Comments

  1. Excellent tip Ryan. I often have to use a text editor to bulk modify scripts and this will come in handy.

    BTW, Congratulations on the birthday of the site…

  2. This is very powerful but somehow I never came across it before, thanks for bringing it to my attention, it will save a lot of time.

  3. Useful [halooglasi.com]
    Happy Birthday! :-)

  4. Thank you for this excellent tip. I used Notepad++ the entire time but never noticed this feature. You have saved me hours of searching.

  5. Thanks. I have never noticed that.

  6. Wow. It freakin’ worked. I was doing 1 file at a time using “edit with notepad” just to replace one character with a word. By the time I was on the 60th file, I thought there had to be a better way because my shoulder was getting sore doing so many clicks with the mouse. But of course nothing in Windows 7 Home “Premium” (Premium-what a joke!). So thank you so, so much for this article to be found.

  7. Hi, thanks for the tips.

    But I am looking for the way to remove the first line of txt file. Can notepad++ handle this way?

    Thank you

Leave Your Comment


Message is the only required field.
Emails are not published.