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: Deniz Dogan
Subject: Re: Emacs equivalent of the ":g" command in vi
Date: Fri, 22 Jul 2011 12:45:14 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0

On 2011-07-22 12:02, C K Kashyap wrote:
     > 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).

    --


replace-regexp is indeed closer to what I am looking for. However, I'd
like the result to not leave blank lines.

Regards,
Kashyap

First, either move to the start of where you want to search OR make an active region (select) the parts where you want it to take effect. M-< goes to the beginning of the buffer and C-x h marks the whole buffer, FYI.

Now, M-x delete-matching-lines RET your_regexp RET

Deniz




reply via email to

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