unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "HS" <hugows@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: file filtering
Date: 31 Jan 2007 06:51:55 -0800	[thread overview]
Message-ID: <1170255115.371658.187620@m58g2000cwm.googlegroups.com> (raw)
In-Reply-To: <uhcu7pbax.fsf@gmail.com>

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'."

  reply	other threads:[~2007-01-31 14:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-30 15:34 file filtering Peter Tury
2007-01-30 16:58 ` HS
2007-01-31  8:05   ` Peter Tury
2007-01-31 12:50     ` HS
2007-01-31 13:34       ` Peter Tury
2007-01-31 14:51         ` HS [this message]
2007-02-01  7:47           ` Peter Tury
2007-02-01 14:26             ` Mathias Dahl
2007-02-04 17:18             ` Kevin Rodgers
     [not found]             ` <mailman.3999.1170609530.2155.help-gnu-emacs@gnu.org>
2007-02-14 12:19               ` Peter Tury
2007-02-01  5:55 ` Kevin Rodgers
     [not found] ` <mailman.3856.1170309361.2155.help-gnu-emacs@gnu.org>
2007-02-14 12:49   ` Peter Tury

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1170255115.371658.187620@m58g2000cwm.googlegroups.com \
    --to=hugows@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).