all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to find lines not matching a certain pattern - ie grep -v
@ 2015-02-22 18:11 gnuist006
  2015-02-22 20:40 ` Dan Espen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: gnuist006 @ 2015-02-22 18:11 UTC (permalink / raw)
  To: help-gnu-emacs

Hi All,

Once in a while I have to do something to lines that do not have a certain string or set of strings in them. I know how to find lines with a string. I also know how to find lines with a set of strings, ie by using the regexp

string1\|string2\| ....

But I dont know how to find strings that do not have the string or strings.

For the moment, I have been doing this in bash using grep -v. I assume that this is also doable in awk and possibly sed. But I dont know how to do this in a direct manner in emacs.

One indirect method in emacs would be to search for the lines with the strings and label/mark them with # in the beginning.

Next, label/mark all the lines with @ in the beginning.

Next, replace all the @#'s in the beginning with # or even nothing, ie ""

Now, you can search for all the lines with @ in the beginning and do whatever to them.


I assume that this is such a common operation that there would be something cleaner and better for this in emacs already.

Cheers
Bolega



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

end of thread, other threads:[~2015-02-25  1:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22 18:11 How to find lines not matching a certain pattern - ie grep -v gnuist006
2015-02-22 20:40 ` Dan Espen
2015-02-22 22:01   ` ltolenaar
2015-02-25  1:29     ` Robert Thorpe
2015-02-22 20:55 ` Drew Adams
2015-02-23  3:23 ` Barry Margolin
2015-02-23  4:20   ` Michael Heerdegen

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.