[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file filtering
From: |
HS |
Subject: |
Re: file filtering |
Date: |
31 Jan 2007 06:51:55 -0800 |
User-agent: |
G2/1.0 |
On 31 jan, 10:34, Peter Tury <tury.pe...@gmail.com> wrote:
> "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 :-((
Hmm... I can find in mine and I'm also using GNU Emacs 22
"keep-lines is an interactive compiled Lisp function in `replace.el'."