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

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

Re: Search and replace for a single file using a pattern file


From: Robert Pluim
Subject: Re: Search and replace for a single file using a pattern file
Date: Thu, 04 Jan 2018 11:28:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Angus Comber <anguscomber@gmail.com> writes:

> I have some horrible logs where integers are printed for states and
> I want to do a global search and replace on the file to eg replace
> integer x with a string.
>
> I can obviously do individually using c-m-% but that is fairly
> laborious.  So use of a search and replace mapping in a text file
> would be really convenient.
>
> Is this possible?  any suggestions?

Which bit is laborious? The query portion of C-M-%? You can hit !
after the first match, or else do

M-: (replace-string "from" "to")

multiple times (or wrap that in a function over your list of
replacements)

Robert



reply via email to

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