Indiana University
University Information Technology Services
What are archived documents?

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.


In Emacs, how can I search for and replace text?

Emacs has two types of search and replace functions: unconditional and queried.

Note: If you aren't sure how to enter the following commands in Emacs, see In Emacs, how are keystrokes denoted?

Unconditional search and replace

To perform an unconditional search and replace, press M-x . Then enter:

replace-string RET your_search_string RET your_replace_string

Replace your_search_string with the existing text string you want to find and remove, and replace your_replace_string with the new text you want to add in its place.

Queried search and replace

To do a queried search and replace (with a prompt for replacing each occurrence of a text string), press M-% . You will then be prompted for your search and replace strings. Emacs will find and display each occurrence of the search string and ask you for further instructions. You can respond with any of the following options:

Spacebar Replace text and find the next occurrence
Del Leave text as is and find the next occurrence
. (period) Replace text, then stop looking for occurrences
! (exclamation point) Replace all occurrences without asking
^ (caret) Return the cursor to previously replaced text

If you type any other character, Emacs will stop looking for occurrences and execute the character as a command. To restart the queried search and replace, type:

C-x M- M-RET

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document abdp in domain all.
Last modified on September 16, 2010.

I need help with a computing problem

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

I have a comment for the Knowledge Base

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.