[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file filtering
From: |
Peter Tury |
Subject: |
Re: file filtering |
Date: |
Wed, 31 Jan 2007 13:34:55 GMT |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (windows-nt) |
"HS" <hugo...> writes:
> Hm... I can't imagine how "not to read into a buffer"...
> I just tried something like this, and it works:
>
> (defun process-file (file)
> (interactive "f")
> (with-temp-buffer
> (insert-file-contents file)
> (delete-non-matching-lines "valid [0-9]+")
> (replace-regexp "valid \\([0-9]+\\)" "I found a \\1" )
> (write-file "test2.txt" nil)))
Thanks! I've already learned new things from your answer:
with-temp-file, keep-lines, etc. And I like this solution. The only
disturbance this goes through the whole buffer twice...
And: why I can't find keep-lines in my Emacs 22's info? I really
searched the info for similar functions before my first ask and didn't
find this :-((