From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: using find-grep in emacs Date: Tue, 14 May 2013 19:19:17 +0200 Message-ID: <51927215.4010100@easy-emacs.de> References: <3477d0ac-7526-4dd7-bc43-7dca9edb1d23@googlegroups.com> <20130514044510.GB17139@dismay.proulx.com> <51922478.7090506@easy-emacs.de> <4C6D96CF-3362-4D80-8875-5959D9B7243C@Web.DE> <20130514154207.GA28848@hysteria.proulx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1368551831 15264 80.91.229.3 (14 May 2013 17:17:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 May 2013 17:17:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 14 19:17:12 2013 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 1UcIqc-0007Nt-PI for geh-help-gnu-emacs@m.gmane.org; Tue, 14 May 2013 19:17:10 +0200 Original-Received: from localhost ([::1]:51399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcIqc-0003af-5e for geh-help-gnu-emacs@m.gmane.org; Tue, 14 May 2013 13:17:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcIqG-0003Nt-PI for help-gnu-emacs@gnu.org; Tue, 14 May 2013 13:16:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcIqF-0006hj-7e for help-gnu-emacs@gnu.org; Tue, 14 May 2013 13:16:48 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.171]:49810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcIqE-0006hW-TT for help-gnu-emacs@gnu.org; Tue, 14 May 2013 13:16:47 -0400 Original-Received: from [192.168.178.21] (brln-4db9f444.pool.mediaWays.net [77.185.244.68]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0La2FZ-1UFavg2mGT-00lYlA; Tue, 14 May 2013 19:16:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 In-Reply-To: <20130514154207.GA28848@hysteria.proulx.com> X-Provags-ID: V02:K0:060FUIEuiQymTRXW3y1ArObUtU8l+GFDFSrvGgZQSOD tCtqMSUdbho2CwQUvhdGIDYuENZuBpMGTRVpQOyKSqz0KePq97 r9bKbVc9W/vUD/CYoAq/9bFBcPPXRtaCLr8AS2ucZeOVD3ixz5 p32ILB60wjFbt6Bze5NFwlhHe+s1Zf4TJT6VmC+WBmrmSqIRwo tH1IppNCnhCE9duV9SyGpHHnRv9+ZK5gyx25r4TnwL03p6ozPY R8Dz1lJ+vXUUcxIuhognGDf1knPx938p/ROnwK539bLWfFcN7G QwD6lu/VXXbSTxLx0ARyjBrFsDMcAW7sEADcOLkdqAFzB91bXU 7s9y5KDf2AdqdotlzzEfxHRkgAKZus5DyX0DsTaWL X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.126.171 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:90769 Archived-At: Am 14.05.2013 17:42, schrieb Bob Proulx: > Peter Dyballa wrote: >> schrieb Andreas Röhler: >>> Because a Null -- 0 -- offers the most space to fill all that in? >> >> No! It's the least space to read from. No other file ends earlier. > > In case this issue confuses people I wanted to say a few words. Prior > to the addition of the grep -H option the behavior was this following. > The grep, egrep, fgrep programs would print matching lines from files. > If one file was searched then no file name would be printed. If more > than one file was searched then grep would prefix the line by the name > of the file so that you could tell which file it came from. > > So the problem was how do you instruct grep to print the name of the > file even when you were only searching one file? The answer was to > tell grep to search more than one file. But, you say, I only want to > search one file. The answer is to search /dev/null in addition to > whatever file you are wanting to search. /dev/null will return end of > file immediately. It won't use any cpu time. With multiple files > being searched grep will print the file name on each line. An elegant > Unix solution. That is why the grep template uses grep with /dev/null > so that grep will print the file name so that Emacs compile mode can > parse it. > > GNU grep has an extension to print file names without needing to have > an extra null file argument. With GNU grep you can specify the -H > option and GNU grep will print the file name for all matches > regardless of the number of files being searched. Newer emacs > versions use this option and make the assumption that you have GNU > grep available. (Or it might figure it out dynamically. I don't > know.) > > But the grep -H option is only available in GNU grep for the GNU > system and BSD grep for BSD systems. It is not available in the older > traditional Unix systems. It isn't in the POSIX standard. Therefore > using -H is non-portable. It won't work on HP-UX or IBM AIX for example. > > http://pubs.opengroup.org/onlinepubs/009695399/utilities/grep.html > > But if you are using Emacs then you probably have grep -H available > too and might as well use it. > > The Emacs grep find templates can be customized. See the > grep-find-template variable in this case for example. > > Bob > > Thanks a lot digging into, great to learn that. Andreas