From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.help Subject: Re: How to kill line beginning with specific string Date: Thu, 19 Nov 2009 19:45:16 +0900 Organization: NEC Electronics Message-ID: References: <26413518.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1258630905 31276 80.91.229.12 (19 Nov 2009 11:41:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Nov 2009 11:41:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 19 12:41:38 2009 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 1NB5OL-0000ZR-SA for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2009 12:41:38 +0100 Original-Received: from localhost ([127.0.0.1]:51881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NB5OL-0005zj-DH for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2009 06:41:37 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-X-Trace: individual.net fWE3y9rABcp4DT7KrxkVzwJSKFS0Iyd6yFZwP7SajFBwtU207+ Cancel-Lock: sha1:O/e+MtJyhgjrv5vAYMl6bFQCMj0= sha1:Ia/THg4HJfKsobiHDBbGS94+/Mc= System-Type: x86_64-unknown-linux-gnu Blat: Foop Importance: high Original-Xref: news.stanford.edu gnu.emacs.help:174836 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:69911 Archived-At: Peter Dyballa 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.