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

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

Re: [h-e-w] Removing lines that match a pattern


From: Simon Green
Subject: Re: [h-e-w] Removing lines that match a pattern
Date: Fri, 2 Nov 2001 15:25:32 +0000

>>>>> "PB" == Peter Brown <address@hidden> writes:

 PB> if you have cygwin-like tools installed, you can do
 PB> C-u M-| grep <insert your regexp here>

 PB> i.e., shell commmand (grep) on region, to keep lines matching the regexp

 PB> ...use grep -v to remove matching lines

The emacs function he's looking for is M-x flush-lines RET ^SOME HEADER RET.
For large files, grep can be much faster tho'

--Simon

 PB> On Fri, 2 Nov 2001, Moore, Mathew L wrote:

 >> I would like to remove the lines of a (very long) file that start with a
 >> specific pattern.  Do I need to write a lisp function, or does anyone know a
 >> way to do it with regexp?
 >> 
 >> I've tried
 >> 
 >> Replace regexp: SOME HEADER\(.*\) with:
 >> 
 >> (just hitting RET after the with), but this only removes the text of the
 >> line, not the line itself.
 >> 
 >> Unfortunately, I don't know Emacs Lisp, but maybe this is a good time to
 >> start learning?
 >> 
 >> Thanks for all your help,
 >> --Matt
 >> 

 PB> -- 
 PB> Peter Brown                 Senior Software Engineer
 PB> Dept. of Computer Science        140 Governors Drive
 PB> University of Massachusetts   Amherst, MA 01003-4610
 PB> Phone: (413) 577-2505            Fax: (413) 545-1249
 PB> address@hidden  http://www.cs.umass.edu/~pbrown







reply via email to

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