Editing text can be time consuming. To save time, gedit includes a Replace function that helps you to find and replace portions of text.
Open the Replace tool by clicking Menu button ▸ Find and Replace… or press Ctrl+H.
Enter the text that you wish to replace into the Search for: field.
Enter the new, replacement text into the Replace with: field.
Once you have entered the original and replacement text, you can add extra parameters to the search. You can also choose what you want to replace:
To replace only the next match, click Replace.
To replace all occurrences of the searched-for text, click Replace All.
Use the Replace All function with care. Replace All works on the entirety of your text file, and does not allow you to highlight portions of text where the replace function will be performed.
If you wish, you can add some extra parameters to your search:
The Match case option allows you to specify whether you want your search to be case-sensitive. If this option is selected, searches will be case-sensitive. If not, searches will not be case-sensitive.
Use this option to search for a specific word without including fragments of other words. For example, if you searched for the word 'and' with this option selected, the word 'and' would be matched, but the words 'sand' and 'commander' would not be matched.
This command behaves identically to the Find Previous command. If you wish to step through search results from end to beginning, select this option.
With the wrap around option enabled, gedit will re-start the search/replace action at the top of the file after it has reached the bottom of the file. This ensures that your search/replace action is made across your entire file.
You can use escape sequences to search for line breaks, carriage returns, and tabs.
If you actually want to search for a \ (backslash) or one of the escape sequences in the text, you need to escape the backslash with an extra backslash. For example, to search for \, you need to enter \\ into the search or replace field. You can search for escape sequences in the same way: to search for or replace with a \n, use the \\n term.
This work is licensed under a.
Got a comment? Spotted an error? Found the instructions unclear? Send feedback about this page.