[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to kill line beginning with specific string
From: |
Miles Bader |
Subject: |
Re: How to kill line beginning with specific string |
Date: |
Thu, 19 Nov 2009 19:45:16 +0900 |
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
>> Is there a simple way for me to search for and kill all of these lines
>> without having to repeatedly enter the search mode and type ctrl-k
>> when the
>> line is found?
>
> You can check with C-M-s ^2000 .*C-qC-j – it will high-light the
> matching lines. Once you're content you can use replace-regexp to
> replace all that matches the regular expression with nothing.
Perhaps more easily, use the `flush-lines' command, and give it a regexp
of "^" + your string:
E.g., to kill lines beginning with "my prefix":
M-x flush-lines RET ^my prefix RET
[Note that flush-lines operates on all lines _following point_, so you
might want to move to the beginning of the buffer first.]
-Miles
--
Cynic, n. A blackguard whose faulty vision sees things as they are, not as
they ought to be. Hence the custom among the Scythians of plucking out a
cynic's eyes to improve his vision.