From: Peter Tury <tury.peter@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: file filtering
Date: Wed, 31 Jan 2007 13:34:55 GMT [thread overview]
Message-ID: <uhcu7pbax.fsf@gmail.com> (raw)
In-Reply-To: 1170247808.259815.196930@p10g2000cwp.googlegroups.com
"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 :-((
next prev parent reply other threads:[~2007-01-31 13:34 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 [this message]
2007-01-31 14:51 ` HS
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=uhcu7pbax.fsf@gmail.com \
--to=tury.peter@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).