all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Remove all lines containig a keyword
@ 2008-09-14  9:08 Christian Herenz
  2008-09-14  9:53 ` Davin Pearson
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Christian Herenz @ 2008-09-14  9:08 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
I have a huge list of "stuff" I sell / sold.
To print out an actual list, without the stuff that is sold already, It would be 
nice to have a command for doing this task automated - Remove all lines with the 
keyword "sold".
Thanks for your Help,
Christian


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Remove all lines containig a keyword
  2008-09-14  9:08 Christian Herenz
@ 2008-09-14  9:53 ` Davin Pearson
  2008-09-14 12:24 ` harven
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Davin Pearson @ 2008-09-14  9:53 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 14, 9:08 pm, Christian Herenz <her...@physik.hu-berlin.de>
wrote:
> Hi,
> I have a huge list of "stuff" I sell / sold.
> To print out an actual list, without the stuff that is sold already, It would be
> nice to have a command for doing this task automated - Remove all lines with the
> keyword "sold".
> Thanks for your Help,
> Christian

grep?

or M-x flush-lines


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Remove all lines containig a keyword
  2008-09-14  9:08 Christian Herenz
  2008-09-14  9:53 ` Davin Pearson
@ 2008-09-14 12:24 ` harven
  2008-09-14 15:12   ` Ross A. Laird
  2008-09-14 15:18 ` Xah
  2008-09-29  2:46 ` Chris Patterson
  3 siblings, 1 reply; 11+ messages in thread
From: harven @ 2008-09-14 12:24 UTC (permalink / raw)
  To: help-gnu-emacs

M-x replace-regexp RET .*Sold.* C-o RET RET
also works.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Remove all lines containig a keyword
  2008-09-14 12:24 ` harven
@ 2008-09-14 15:12   ` Ross A. Laird
  2008-09-14 20:42     ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: Ross A. Laird @ 2008-09-14 15:12 UTC (permalink / raw)
  To: help-gnu-emacs

harven <harven@free.fr> writes:

> M-x replace-regexp RET .*Sold.* C-o RET RET
> also works.
>

Org-mode is great for this kind of thing. It allows searches and views
by tags, as well as customized cycling of states (eg FORSALE --> BIDFOR
--> SOLD).

Ross


-- 
Ross A. Laird, PhD
www.rosslaird.info





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Remove all lines containig a keyword
  2008-09-14  9:08 Christian Herenz
  2008-09-14  9:53 ` Davin Pearson
  2008-09-14 12:24 ` harven
@ 2008-09-14 15:18 ` Xah
  2008-09-14 16:16   ` Marc Tfardy
  2008-09-15 19:47   ` Christian Herenz
  2008-09-29  2:46 ` Chris Patterson
  3 siblings, 2 replies; 11+ messages in thread
From: Xah @ 2008-09-14 15:18 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 14, 2:08 am, Christian Herenz <her...@physik.hu-berlin.de>
wrote:
> Hi,
> I have a huge list of "stuff" I sell / sold.
> To print out an actual list, without the stuff that is sold already, It would be
> nice to have a command for doing this task automated - Remove all lines with the
> keyword "sold".
> Thanks for your Help,
> Christian

you can just use M-x delete-matching-lines.

Note that there's also list-matching-lines.
these tips are from and more: http://xahlee.org/emacs/emacs_esoteric.html

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Remove all lines containig a keyword
  2008-09-14 15:18 ` Xah
@ 2008-09-14 16:16   ` Marc Tfardy
  2008-09-15 19:47   ` Christian Herenz
  1 sibling, 0 replies; 11+ messages in thread
From: Marc Tfardy @ 2008-09-14 16:16 UTC (permalink / raw)
  To: help-gnu-emacs

Xah schrieb:
> On Sep 14, 2:08 am, Christian Herenz <her...@physik.hu-berlin.de>
> wrote:
>> Hi,
>> I have a huge list of "stuff" I sell / sold.
>> To print out an actual list, without the stuff that is sold already, It would be
>> nice to have a command for doing this task automated - Remove all lines with the
>> keyword "sold".
>> Thanks for your Help,
>> Christian
> 
> you can just use M-x delete-matching-lines.

,----[ C-h f delete-matching-lines RET ]
| delete-matching-lines is an alias for `flush-lines' in `replace.el'.
| (delete-matching-lines regexp &optional rstart rend interactive)
`----

As posted by Davin Pearson.

regards
Marc




^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Remove all lines containig a keyword
  2008-09-14 15:12   ` Ross A. Laird
@ 2008-09-14 20:42     ` Drew Adams
  0 siblings, 0 replies; 11+ messages in thread
From: Drew Adams @ 2008-09-14 20:42 UTC (permalink / raw)
  To: 'Ross A. Laird', help-gnu-emacs

> > M-x replace-regexp RET .*Sold.* C-o RET RET also works.
> 
> Org-mode is great for this kind of thing. It allows searches and views
> by tags, as well as customized cycling of states (eg FORSALE --> BIDFOR
> --> SOLD).

We're getting far afield. The simple answer to the OP's question, as has already
been said, is `M-x flush-lines' (aka `delete-matching-lines').





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Remove all lines containig a keyword
  2008-09-14 15:18 ` Xah
  2008-09-14 16:16   ` Marc Tfardy
@ 2008-09-15 19:47   ` Christian Herenz
  1 sibling, 0 replies; 11+ messages in thread
From: Christian Herenz @ 2008-09-15 19:47 UTC (permalink / raw)
  To: help-gnu-emacs

Xah schrieb:
> On Sep 14, 2:08 am, Christian Herenz <her...@physik.hu-berlin.de>
> wrote:
>> Hi,
>> I have a huge list of "stuff" I sell / sold.
>> To print out an actual list, without the stuff that is sold already, It would be
>> nice to have a command for doing this task automated - Remove all lines with the
>> keyword "sold".
>> Thanks for your Help,
>> Christian
> 
> you can just use M-x delete-matching-lines.
> 
> Note that there's also list-matching-lines.
> these tips are from and more: http://xahlee.org/emacs/emacs_esoteric.html
> 
>   Xah
> ∑ http://xahlee.org/
> 
> ☄


Thanks.. I even bookmarked your site.. But sometimes you don't know where to 
find something, if you need it. I use emacs now for 2 years, and still I do some 
things manually, where I think there is an emacs-command. But I am just a 
student, and maybe looking up a particular command is at first not so fast, as 
doing a specific task manually - and my fellow students may have changed their 
codes faster than me, because I still fiddle out what keys next to press... But 
I think there is a long-term benifit from trying to avoid the mouse while inside 
emacs.


Greets,
Christian


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Remove all lines containig a keyword
  2008-09-14  9:08 Christian Herenz
                   ` (2 preceding siblings ...)
  2008-09-14 15:18 ` Xah
@ 2008-09-29  2:46 ` Chris Patterson
  3 siblings, 0 replies; 11+ messages in thread
From: Chris Patterson @ 2008-09-29  2:46 UTC (permalink / raw)
  To: help-gnu-emacs

Christian Herenz <herenz@physik.hu-berlin.de> writes:

> Hi,
> I have a huge list of "stuff" I sell / sold.
> To print out an actual list, without the stuff that is sold already,
> It would be nice to have a command for doing this task automated -
> Remove all lines with the keyword "sold".
> Thanks for your Help,
> Christian

Looks like you have several suggestions. I'll chime in with M-x
flush-lines.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Remove all lines containig a keyword
@ 2008-10-03 13:54 Bourgneuf Francois
  2008-10-03 14:06 ` Parker, Matthew
  0 siblings, 1 reply; 11+ messages in thread
From: Bourgneuf Francois @ 2008-10-03 13:54 UTC (permalink / raw)
  To: Chris Patterson, help-gnu-emacs

C-M-% .*sold.*C-q C-j Enter !

I explain :
C-M-% : query-replace-regexp
.*sold.*C-q C-j : 0-n character followed by "sold" followed by 0-n character followed by NEWLINE ( C-q C-j )
Bour9

> -----Message d'origine-----
> De : 
> help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.fr@gnu.or
> g 
> [mailto:help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.f
> r@gnu.org] De la part de Chris Patterson
> Envoyé : lundi 29 septembre 2008 04:46
> À : help-gnu-emacs@gnu.org
> Objet : Re: Remove all lines containig a keyword
> 
> Christian Herenz <herenz@physik.hu-berlin.de> writes:
> 
> > Hi,
> > I have a huge list of "stuff" I sell / sold.
> > To print out an actual list, without the stuff that is sold already,
> > It would be nice to have a command for doing this task automated -
> > Remove all lines with the keyword "sold".
> > Thanks for your Help,
> > Christian
> 
> Looks like you have several suggestions. I'll chime in with M-x
> flush-lines.
> 
> 




^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Remove all lines containig a keyword
  2008-10-03 13:54 Remove all lines containig a keyword Bourgneuf Francois
@ 2008-10-03 14:06 ` Parker, Matthew
  0 siblings, 0 replies; 11+ messages in thread
From: Parker, Matthew @ 2008-10-03 14:06 UTC (permalink / raw)
  To: Bourgneuf Francois, Chris Patterson, help-gnu-emacs

Hide-lines.el is also useful

http://www.emacswiki.org/cgi-bin/wiki/hide-lines.el

from the commentary...


;; Now, when you type C-c h, you will be prompted for a regexp
;; (regular expression).  All lines matching this regexp will be
;; hidden in the buffer.
;; 
;; Alternatively, you can type C-u C-c h (ie. provide a prefix
;; argument to the hide-lines command) to hide all lines that *do not*
;; match the specified regexp.
;; 
;; If you want to make all of the hidden areas re-appear again, type:
;; M-x show-all-invisible
;; Or you can bind show-all-invisible to a key and use that to show
;; all the hidden areas again.






And from the emacs manual...

20.10 Other Search-and-Loop Commands
====================================

Here are some other commands that find matches for a regular
expression.  They all ignore case in matching, if the pattern contains
no upper-case letters and `case-fold-search' is non-`nil'.  Aside from
`occur' and its variants, all operate on the text from point to the end
of the buffer, or on the active region in Transient Mark mode.

`M-x occur <RET> REGEXP <RET>'
     Display a list showing each line in the buffer that contains a
     match for REGEXP.  To limit the search to part of the buffer,
     narrow to that part (*note Narrowing::).  A numeric argument N
     specifies that N lines of context are to be displayed before and
     after each matching line.  Currently, `occur' can not correctly
     handle multiline matches.

     The buffer `*Occur*' containing the output serves as a menu for
     finding the occurrences in their original context.  Click
     `Mouse-2' on an occurrence listed in `*Occur*', or position point
     there and type <RET>; this switches to the buffer that was
     searched and moves point to the original of the chosen occurrence.
     `o' and `C-o' display the match in another window; `C-o' does not
     select it.

     After using `M-x occur', you can use `next-error' to visit the
     occurrences found, one by one.  *Note Compilation Mode::.

`M-x list-matching-lines'
     Synonym for `M-x occur'.

`M-x multi-occur <RET> BUFFERS <RET> REGEXP <RET>'
     This function is just like `occur', except it is able to search
     through multiple buffers.  It asks you to specify the buffer names
     one by one.

`M-x multi-occur-in-matching-buffers <RET> BUFREGEXP <RET> REGEXP <RET>'
     This function is similar to `multi-occur', except the buffers to
     search are specified by a regular expression that matches visited
     file names.  With a prefix argument, it uses the regular
     expression to match buffer names instead.

`M-x how-many <RET> REGEXP <RET>'
     Print the number of matches for REGEXP that exist in the buffer
     after point.  In Transient Mark mode, if the region is active, the
     command operates on the region instead.

`M-x flush-lines <RET> REGEXP <RET>'
     This command deletes each line that contains a match for REGEXP,
     operating on the text after point; it deletes the current line if
     it contains a match starting after point.  In Transient Mark mode,
     if the region is active, the command operates on the region
     instead; it deletes a line partially contained in the region if it
     contains a match entirely contained in the region.

     If a match is split across lines, `flush-lines' deletes all those
     lines.  It deletes the lines before starting to look for the next
     match; hence, it ignores a match starting on the same line at which
     another match ended.

`M-x keep-lines <RET> REGEXP <RET>'
     This command deletes each line that _does not_ contain a match for
     REGEXP, operating on the text after point; if point is not at the
     beginning of a line, it always keeps the current line.  In
     Transient Mark mode, if the region is active, the command operates
     on the region instead; it never deletes lines that are only
     partially contained in the region (a newline that ends a line
     counts as part of that line).

     If a match is split across lines, this command keeps all those
     lines.






Matthew Parker

SEI  | 1 Freedom Valley Drive | Oaks, PA 19456 | p: 610-676-1279 | f: 484-676-1279 | www.seic.com
-----Original Message-----
From: help-gnu-emacs-bounces+mparker=seic.com@gnu.org [mailto:help-gnu-emacs-bounces+mparker=seic.com@gnu.org] On Behalf Of Bourgneuf Francois
Sent: Friday, October 03, 2008 9:54 AM
To: Chris Patterson; help-gnu-emacs@gnu.org
Subject: RE: Remove all lines containig a keyword

C-M-% .*sold.*C-q C-j Enter !

I explain :
C-M-% : query-replace-regexp
.*sold.*C-q C-j : 0-n character followed by "sold" followed by 0-n character followed by NEWLINE ( C-q C-j )
Bour9

> -----Message d'origine-----
> De : 
> help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.fr@gnu.or
> g 
> [mailto:help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.f
> r@gnu.org] De la part de Chris Patterson
> Envoyé : lundi 29 septembre 2008 04:46
> À : help-gnu-emacs@gnu.org
> Objet : Re: Remove all lines containig a keyword
> 
> Christian Herenz <herenz@physik.hu-berlin.de> writes:
> 
> > Hi,
> > I have a huge list of "stuff" I sell / sold.
> > To print out an actual list, without the stuff that is sold already,
> > It would be nice to have a command for doing this task automated -
> > Remove all lines with the keyword "sold".
> > Thanks for your Help,
> > Christian
> 
> Looks like you have several suggestions. I'll chime in with M-x
> flush-lines.
> 
> 






^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-10-03 14:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-03 13:54 Remove all lines containig a keyword Bourgneuf Francois
2008-10-03 14:06 ` Parker, Matthew
  -- strict thread matches above, loose matches on Subject: below --
2008-09-14  9:08 Christian Herenz
2008-09-14  9:53 ` Davin Pearson
2008-09-14 12:24 ` harven
2008-09-14 15:12   ` Ross A. Laird
2008-09-14 20:42     ` Drew Adams
2008-09-14 15:18 ` Xah
2008-09-14 16:16   ` Marc Tfardy
2008-09-15 19:47   ` Christian Herenz
2008-09-29  2:46 ` Chris Patterson

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.