help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to do search and replace with a lookup


From: Angus Comber
Subject: How to do search and replace with a lookup
Date: Mon, 11 Dec 2017 00:49:47 -0800 (PST)
User-agent: G2/1.0

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]