From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: LEE Sau Dan Newsgroups: gmane.emacs.help Subject: Re: grep can help? Date: 21 Apr 2004 18:52:10 +0200 Organization: Rechenzentrum der Universitaet Freiburg, Germany Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-7 X-Trace: sea.gmane.org 1082580368 16362 80.91.224.253 (21 Apr 2004 20:46:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 21 Apr 2004 20:46:08 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 21 22:46:03 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BGOba-0001U6-00 for ; Wed, 21 Apr 2004 22:46:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BGObL-0007fS-N2 for geh-help-gnu-emacs@m.gmane.org; Wed, 21 Apr 2004 16:45:47 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news.uni-freiburg.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: savona.informatik.uni-freiburg.de User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:122537 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 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 Xref: main.gmane.org gmane.emacs.help:17824 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17824 >>>>> "FCC" == FCC writes: FCC> Hello all, Here is what I am trying to do: I have fortran90 FCC> source files full of comments everywhere. A comment starts FCC> with ! and continues until the end of line, and it can start FCC> in the middle of a line after some code that gets compiled. ... FCC> Then came the idea to use grep. Now, grep --regexp="\B!.*" FCC> --only-matching --no-filename efe2.f90 successfully displays FCC> all comments in the file efe2.f90, regardless of whether thay FCC> appear by themselves on a line or they share the same line FCC> with legitimate code, thanks to the option FCC> --only-matching. Now, what I need is exact inverse, so I use: FCC> grep --invert-match --regexp="\B!.*" --only-matching FCC> --no-filename EFEDriver2.f90. I was expecting an output equal FCC> to the efe2.f90 without all the comments. But I get nothing, FCC> only a comment saying that there were matches. sed 's/!.*$//' foobar.f90 > foobar-sans-comments.f90 -- Lee Sau Dan +Z05biGVm-(Big5) ~{@nJX6X~}(HZ) E-mail: danlee@informatik.uni-freiburg.de Home page: http://www.informatik.uni-freiburg.de/~danlee