How to search and replace with nano text editor

Nano is a very compact and feature packed text editor commonly found on Linux and Unix based OS. One of the lesser used feature that is very useful is search & replace.

To Search and Replace text in the currently open file:

The search string can also be a regular expression.

14 thoughts on “How to search and replace with nano text editor”

  1. Not sure if I am the only one but i found that the only way I could toggle the regex search was to M-R while in the Search function (i.e. ^W)

  2. Need to do a “search and destroy”. i.e.
    1. delete all lines beginning with (delete, NOT replace)
    2. delete all instances of . (delete, NOT replace)

Leave a Reply

Your email address will not be published. Required fields are marked *