Replace portions of text in a file.
Jim Campbell
jcampbell@gnome.org
Daniel Neel
dneelyep@gmail.com
Sindhu S
sindhus@live.in
Ekaterina Gerasimova
kittykat3756@gmail.com
Shobha Tyagi
tyagishobha@gmail.com
Young Li
li.young1618@gmail.com

# Replace text

Editing text can be time consuming. To save time, gedit includes a Replace function that helps you to find and replace portions of text.

# geditで文字を置き換える

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

# More options

If you wish, you can add some extra parameters to your search:

## Match case

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.

## Match entire word only

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.

## Search backwards

This command behaves identically to the Find Previous command. If you wish to step through search results from end to beginning, select this option.

## Wrap around

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.

# Using escape sequences

You can use escape sequences to search for line breaks, carriage returns, and tabs.

## \n

Newline

## \r

Carriage return

## \t

Tab

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.