From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: How to find lines not matching a certain pattern - ie grep -v Date: Sun, 22 Feb 2015 12:55:31 -0800 (PST) Message-ID: <2ee45e5e-3350-488b-8253-663bc7d3d96b@default> References: <6a41f4ac-f7e7-49f1-a593-501d82d4c733@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1424638569 30404 80.91.229.3 (22 Feb 2015 20:56:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Feb 2015 20:56:09 +0000 (UTC) To: gnuist006@gmail.com, help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 22 21:55:57 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YPdZD-0004Y9-Cy for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Feb 2015 21:55:55 +0100 Original-Received: from localhost ([::1]:41226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPdZC-0001OA-VH for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Feb 2015 15:55:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPdZ3-0001O4-68 for help-gnu-emacs@gnu.org; Sun, 22 Feb 2015 15:55:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPdYz-0002Xk-5l for help-gnu-emacs@gnu.org; Sun, 22 Feb 2015 15:55:45 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:48785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPdYy-0002Wp-Q1 for help-gnu-emacs@gnu.org; Sun, 22 Feb 2015 15:55:40 -0500 Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t1MKtcVn022089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 22 Feb 2015 20:55:39 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t1MKtctK012097 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 22 Feb 2015 20:55:38 GMT Original-Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id t1MKtbHN008215; Sun, 22 Feb 2015 20:55:37 GMT In-Reply-To: <6a41f4ac-f7e7-49f1-a593-501d82d4c733@googlegroups.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102833 Archived-At: > Once in a while I have to do something to lines that do not have a certai= n > 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\| .... >=20 > But I dont know how to find strings that do not have the string or string= s. A. If you use Icicles then: 1. You can complement the search domain (the set of search contexts). In the case of `icicle-occur', which is analogous to `occur' and `grep', the search contexts are lines, so searching with complementing means searching the lines that do not match the context-defining regexp. You can use `C-M-~' anytime during Icicles search, to toggle whether to search the originally defined search contexts or their complements. http://www.emacswiki.org/emacs/Icicles_-_Search_Commands%2c_Overview#Searc= hOutsideContexts 2. #1 is about complementing the set of search contexts, that is, the regions of text that you define initially and then search incrementally. = =20 Another, more common kind of complementing is to complement the set of current search hits, on the fly. For that, you hit `C-~'. That is the Icicles way to complement the current set of completion candidates, to show those from the initial domain (or the last narrowing via `S-SPC') that do not belong to the current set of hits. So you type a pattern to match, and then hit `C-~', to see all of the thingies that do NOT match that pattern. http://www.emacswiki.org/emacs/Icicles_-_Nutshell_View#ChippingAway B. If you use library `isearch-prop.el' then you can get another kind of complementing with Isearch: You can search zones of text/overlays that have a given property, or you can search the complement: the zones that do NOT have a given property. You can toggle this search-domain complementing at any time during Isearch, using `C-M-~'. http://www.emacswiki.org/emacs/IsearchPlus#isearchp-toggle-complementing-d= omain