I want to find specific characters/strings with nano and delete all occurrences. How can this be done with nano and can this even be done?
Asked
Active
Viewed 1,087 times
1 Answers
5
Find and Replace
This use of "Find and Replace" works in Nano 5.8: (I have tested)
- Press Alt-R (default keybinding)
Search (to replace):
Enter the string you want to search for, and press EnterReplace with:
Just press Enter (leaving the replace string blank)Replace this instance?
Press A to repace all instances of string with no characters (thus removing it)
Upgrade Nano to a newer version (for 20.04 LTS)
There are 2 options: (I have tested both)
Uninstall the
deb
version of Nano, and install thesnap
version (currently 5.7):sudo snap install nano --classic
Download a newer and compatible Debian package (currently 5.4 available) and install:
sudo apt install ./nano_5.4-2_amd64.deb

Artur Meinild
- 26,018
re.sub(regex, replacement, myString) with myString.replace(searchCriteria, replacement)
, and it'll still do new lines (without having to use regular expressions). – Brōtsyorfuzthrāx Oct 05 '22 at 07:29