From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: reader@newsguy.com Newsgroups: gmane.emacs.help Subject: Re: Run Shell Command on Buffer Date: Thu, 25 Jan 2007 00:47:41 -0600 Organization: Still searching... Message-ID: <87mz47a9gy.fsf@newsguy.com> References: <8572445.post@talk.nabble.com> <20070124234028.GA15247@fastmail.fm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1169707698 4665 80.91.229.12 (25 Jan 2007 06:48:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Jan 2007 06:48:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 25 07:48:12 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H9yP5-0003Pi-9h for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jan 2007 07:48:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9yP3-0007e3-Vx for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jan 2007 01:48:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H9yOq-0007dq-PY for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 01:47:56 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H9yOp-0007de-6B for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 01:47:55 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9yOo-0007db-Vu for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 01:47:55 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H9yOo-0003qU-Ka for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 01:47:54 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1H9yOk-0000cQ-7h for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 07:47:50 +0100 Original-Received: from c-67-163-25-192.hsd1.in.comcast.net ([67.163.25.192]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Jan 2007 07:47:50 +0100 Original-Received: from reader by c-67-163-25-192.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Jan 2007 07:47:50 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 26 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: c-67-163-25-192.hsd1.in.comcast.net User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux) Cancel-Lock: sha1:ZZtFDrkT/bhDxcspF1k3qc7RfyU= X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40627 Archived-At: super-nub writes: > Hi Pete, > > for example I want to execute `grep' on my buffer/file to get a > survey of the section headings in my document (that I keep in a > special format for this purpose), e.g.: > > $ egrep '^\s*-[[:upper:]]+' myfile > $ -INTRODUCTION > $ -BLA BLA > $ -BLA 2 > $ -MAIN PART > $ -MISCELLANEOUS > $ -ETC BLA BLA It looks like `M-x occur' may be what you want. It will display all the hits in a separate buffer. Another nifty aspect is that you can use the hits provided as links to jump to them in the parent buffer. If I understood your usage M-x occur will be just the ticket. If you like this tool... type M-x occur to see other formulations of using it.