[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep can help?
From: |
FCC |
Subject: |
Re: grep can help? |
Date: |
Wed, 21 Apr 2004 19:59:22 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316 |
FCC wrote:
Hello all,
Here is what I am trying to do: I have fortran90 source files full of
comments everywhere. A comment starts with ! and continues until the end
of line, and it can start in the middle of a line after some code that
gets compiled.
Initially I was trying to use isearch for a regexp but only to search
for those occurences which are not in comments (or which do not appear
after the character !). After spending some time with Google, it turned
out that this is not possible because one cannot "invert a match", which
is what is required here.
OK, I think I solved my problem: replace-regexp "!.*" " " and all the
comments are gone, and the line numbers are unchanged. Now, the
resulting file can be saved under a different file name, or the buffer
could be renamed and the intended regexp search can be performed, either
with occur or isearch-regexp.
Thanks all anyway.
Best,
FCC.
PS. If there is a better solution, I would like to hear it.