From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: Emacs equivalent of the ":g" command in vi Date: Fri, 22 Jul 2011 11:48:52 +0200 Message-ID: <8762mufxx7.fsf@gmail.com> References: <14F21CEC-7265-4DE4-888A-A10FCFFF6826@Web.DE> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1311328156 28991 80.91.229.12 (22 Jul 2011 09:49:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 22 Jul 2011 09:49:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 22 11:49:13 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QkCM4-0007O7-Lj for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Jul 2011 11:49:12 +0200 Original-Received: from localhost ([::1]:55221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkCM4-0004H3-05 for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Jul 2011 05:49:12 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:54778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkCLz-0004Gy-G2 for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 05:49:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QkCLy-0005L0-MR for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 05:49:07 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:40660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkCLy-0005Ku-G5 for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 05:49:06 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QkCLw-0007MK-Rn for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 11:49:04 +0200 Original-Received: from 82.211.85.79.rev.sfr.net ([79.85.211.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2011 11:49:04 +0200 Original-Received: from thierry.volpiatto by 82.211.85.79.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2011 11:49:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 32 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 82.211.85.79.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:Zx33Uu3iUmgou2hxBv5MNza5ijE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81724 Archived-At: Peter Dyballa writes: > Am 22.07.2011 um 10:42 schrieb C K Kashyap: > >> I need to perform a certain action (such as delete the line) on each line of >> a buffer if the line matches a regular expression. In vim, we can use the :g >> command for this. > > I don't know that :g in vim that exactly, I prefer to use ``.´´ from time to time. > > GNU Emacs allows to use three commands: > > repeat > repeat-complex-command > repeat-matching-complex-command > > See which one can be used! (Deleting a single line is simple: C-k, > deleting a bunch of lines is also quite simple: C-u C-k – > which could be as simple as in vi/vim.) I think he want to delete lines matching a regexp, so C-k is not what he wants here. `query-replace-regexp' can be used with a regexp like this: ^.*\(your_regexp\).*$ and you replace with nothing (empty prompt). -- A+ Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997