From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Add +2 to all numbers in file Date: Fri, 27 Feb 2009 18:58:44 +0100 Organization: Informatimago Message-ID: <87d4d37odn.fsf@galatea.local> 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 1235760111 18125 80.91.229.12 (27 Feb 2009 18:41:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Feb 2009 18:41:51 +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 19:43:07 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 1Ld7fu-0005W7-BB for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Feb 2009 19:43:06 +0100 Original-Received: from localhost ([127.0.0.1]:49862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ld7eZ-0007hS-5U for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Feb 2009 13:41:43 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!news.glorb.com!news2.glorb.com!feeder.erje.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-a.proxad.net!nnrp16-1.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no Importance: high User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) Cancel-Lock: sha1:OTg1ZjM2ZWI0YjM5OTMzODkzYjc5YzhjYTdmNTg1OTUwN2ExM2I5Ng== Original-Lines: 26 Original-NNTP-Posting-Date: 27 Feb 2009 18:58:46 MET Original-NNTP-Posting-Host: 88.182.134.169 Original-X-Trace: 1235757526 news-2.free.fr 29478 88.182.134.169:57532 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:167142 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:62445 Archived-At: sharky 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__