help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs equivalent of the ":g" command in vi


From: Thierry Volpiatto
Subject: Re: Emacs equivalent of the ":g" command in vi
Date: Fri, 22 Jul 2011 11:48:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Peter Dyballa <Peter_Dyballa@Web.DE> 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 <number> 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 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]