From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.help Subject: Re: Add +2 to all numbers in file Date: Fri, 27 Feb 2009 17:32:22 +0900 Organization: Emacsen advocacy group Message-ID: References: <278c44c4-39e2-4a43-a4f7-f047bb433653@33g2000yqm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1235724165 14565 80.91.229.12 (27 Feb 2009 08:42:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Feb 2009 08:42:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 27 09:44:01 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LcyK8-0004X1-Ia for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Feb 2009 09:44:00 +0100 Original-Received: from localhost ([127.0.0.1]:59811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LcyIn-0007ES-Nj for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Feb 2009 03:42:37 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!newshub.sdsu.edu!feeder.erje.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-X-Trace: individual.net mV3FITd+Glp3C70Lugd7IAEU7pbiAxnTSM6s0aKDXzP5YBCDs= Cancel-Lock: sha1:PA6JxcCgTen+rBG3JlEaKOpBoCg= sha1:dXQPaextxfAM76bcY9zP2pyunIA= X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.91 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:167125 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62423 Archived-At: >>>>> sharky wrote: > 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! Try `M-x all+2 RET': (defun all+2 () (interactive "*") (save-excursion (goto-char (point-min)) (while (re-search-forward "[0-9]+" nil t) (replace-match (number-to-string (+ 2 (string-to-number (match-string 0))))))))