From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Dyballa Newsgroups: gmane.emacs.help Subject: Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc Date: Thu, 8 Nov 2007 11:48:53 +0100 Message-ID: <87C0AE5D-BFAF-4026-AB39-FDD0D82ECC17@Web.DE> References: <13640969.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1194518965 24011 80.91.229.12 (8 Nov 2007 10:49:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Nov 2007 10:49:25 +0000 (UTC) Cc: Help-gnu-emacs@gnu.org To: iluvindo Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 08 11:49:29 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Iq4wy-0000k9-J5 for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Nov 2007 11:49:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iq4wn-0003xJ-AD for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Nov 2007 05:49:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iq4wY-0003wq-Ud for help-gnu-emacs@gnu.org; Thu, 08 Nov 2007 05:49:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iq4wT-0003w2-EE for Help-gnu-emacs@gnu.org; Thu, 08 Nov 2007 05:49:01 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iq4wT-0003vz-By for Help-gnu-emacs@gnu.org; Thu, 08 Nov 2007 05:48:57 -0500 Original-Received: from fmmailgate03.web.de ([217.72.192.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iq4wT-0004H8-0y for Help-gnu-emacs@gnu.org; Thu, 08 Nov 2007 05:48:57 -0500 Original-Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate03.web.de (Postfix) with ESMTP id BF1BBAB80082; Thu, 8 Nov 2007 11:48:55 +0100 (CET) Original-Received: from [195.4.205.15] (helo=[192.168.1.2]) by smtp08.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.108 #208) id 1Iq4wR-0000WK-00; Thu, 08 Nov 2007 11:48:55 +0100 In-Reply-To: <13640969.post@talk.nabble.com> X-Mailer: Apple Mail (2.752.2) X-Sender: Peter_Dyballa@web.de X-Provags-ID: V01U2FsdGVkX19kCQPxC834GdttkQ4TTD4CwOI9nryClJf5oSyg x/ZiM3xvBuU4HinSsRTnD1EGHzKs76KFGniH2NfW8BofggXaBT 3EIQLYal2VMaQI3/5mFA== X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49077 Archived-At: Am 08.11.2007 um 05:01 schrieb iluvindo: > Hi I recently moved from vim to emacs and need help to search and > replace > using line numbers(say between two lines 5 and 50). This can be > done in vim > as %5,50s/serah_term/replace_term/gc > What is equivalent in emacs? Activate 'active region highlighting' from Options menu, mark the region either by dragging with the mouse cursor or with the keyboard (M-g g 5 RET C-SPC M-g g 50 RET), and then substitute: M-x replace-string RET RET RET The number of replacements in one line cannot be limited to one. Details can be found in the GNU Emacs tutorial (C-h t) or when asking for a description of the function: C-h f RET There is also a hypertext based documentation: C-h i RET m emacs RET There is also the function replace-regexp which uses regular expressions to search for a string and replace it with another one. -- Greetings Pete Make it simple, as simple as possible but no simpler. Albert Einstein