From: Angus Comber <anguscomber@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: How to do search and replace with a lookup
Date: Mon, 11 Dec 2017 00:49:47 -0800 (PST) [thread overview]
Message-ID: <2a6008be-da30-401d-b48f-da36884bafbd@googlegroups.com> (raw)
I have log file output like this:
Received device state message: pen state = 11 - uig state 10
where pen state and uig state are enums.
I want to do a search and replace where if for example pen state 11 enum is diagnostics and uig state 10 enum is starting, then I want the line to be updated to:
Received device state message: pen state = diagnostics - uig state starting
What is the easiest way to do this?
I can do search and replace using c-m-% and change for each permutation of number to string but that would be fairly labour intensive if enums were fairly long. Can I combine that with a lookup somehow? What is best way to do it?
next reply other threads:[~2017-12-11 8:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-11 8:49 Angus Comber [this message]
2017-12-11 10:03 ` How to do search and replace with a lookup tomas
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=2a6008be-da30-401d-b48f-da36884bafbd@googlegroups.com \
--to=anguscomber@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).