all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: Add +2 to all numbers in file
Date: Fri, 27 Feb 2009 18:58:44 +0100	[thread overview]
Message-ID: <87d4d37odn.fsf@galatea.local> (raw)
In-Reply-To: 278c44c4-39e2-4a43-a4f7-f047bb433653@33g2000yqm.googlegroups.com

sharky <landhaj@yahoo.com> 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.

Type: 

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


-- 
__Pascal Bourguignon__


  parent reply	other threads:[~2009-02-27 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-27  8:18 Add +2 to all numbers in file sharky
2009-02-27  8:32 ` Katsumi Yamaoka
2009-02-27  9:11   ` sharky
2009-02-27 17:58 ` Pascal J. Bourguignon [this message]
2009-02-27 21:55   ` David Kastrup

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d4d37odn.fsf@galatea.local \
    --to=pjb@informatimago.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.