[Top][All Lists]

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

Re: Add +2 to all numbers in file

From: Pascal J. Bourguignon
Subject: Re: Add +2 to all numbers in file
Date: Fri, 27 Feb 2009 18:58:44 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

sharky <address@hidden> writes:

> Hi!
> I have a file with a lot of numbers. It looks like this:
> xx, xx, xx--xx, xx, xx, x
> xx, x, xx--xx, xx--xx, x
> xx, xx
> xx, xx, xx--xx, xx--xx, xx--xx
> You get the picture. Can I make emacs add 2 to each and everyone of
> these numbers?
> Please help!

If you have only one file, you can edit it interactively.  With recent
emacs (eg. 22, perhaps even 21), you can substitute an expression.


M-x replace-regexp RET \([0-9][0-9]*\) RET \,(+ 2 (car (read-from-string \1))) 

__Pascal Bourguignon__

reply via email to

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