all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* arithemtic in buffers
@ 2006-08-10 13:44 Birju Prajapati
  2006-08-10 15:03 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Birju Prajapati @ 2006-08-10 13:44 UTC (permalink / raw)


Hi,
I have a buffer with the follwing:

insert into merge.rule (property, type, source, source_index) values
('primary', NULL,  15,  0);
insert into merge.rule (property, type, source, source_index) values
('primary', NULL, 1, 1);
insert into merge.rule (property, type, source, source_index) values
('primary', NULL, 12, 2);
insert into merge.rule (property, type, source, source_index) values
('primary', NULL, 10, 3);
insert into merge.rule (property, type, source, source_index) values
('primary', NULL, 11, 4);
insert into merge.rule (property, type, source, source_index) values
('primary', NULL, 9, 5);

....and so on....

I need to increase the value of the last digit on each line by one. Is
there an automagic way to do this via emacs? Do I use regular
expressions, M-x calculator, both, or something else to do it? Any
help would be much appreciated

TIA
Birju

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: arithemtic in buffers
  2006-08-10 13:44 Birju Prajapati
@ 2006-08-10 15:03 ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2006-08-10 15:03 UTC (permalink / raw)


    I need to increase the value of the last digit on each line by one. Is
    there an automagic way to do this via emacs? Do I use regular
    expressions, M-x calculator, both, or something else to do it? Any
    help would be much appreciated
    
http://www.emacswiki.org/cgi-bin/wiki/ReplaceCount

http://www.emacswiki.org/cgi-bin/wiki/IncrementNumber

http://www.emacswiki.org/cgi-bin/wiki/NumbersInRegisters

http://www.emacswiki.org/cgi-bin/wiki/EmacsKeyboardMacroCounter

http://www.emacswiki.org/cgi-bin/wiki/KeyboardMacrosTricks

How did I find those pages? Searched for "increment". HTH

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: arithemtic in buffers
       [not found] <mailman.5053.1155222256.9609.help-gnu-emacs@gnu.org>
@ 2006-08-10 15:28 ` David Kastrup
  0 siblings, 0 replies; 3+ messages in thread
From: David Kastrup @ 2006-08-10 15:28 UTC (permalink / raw)


"Drew Adams" <drew.adams@oracle.com> writes:

>     I need to increase the value of the last digit on each line by one. Is
>     there an automagic way to do this via emacs? Do I use regular
>     expressions, M-x calculator, both, or something else to do it? Any
>     help would be much appreciated
>     
> http://www.emacswiki.org/cgi-bin/wiki/ReplaceCount
>
> http://www.emacswiki.org/cgi-bin/wiki/IncrementNumber
>
> http://www.emacswiki.org/cgi-bin/wiki/NumbersInRegisters
>
> http://www.emacswiki.org/cgi-bin/wiki/EmacsKeyboardMacroCounter
>
> http://www.emacswiki.org/cgi-bin/wiki/KeyboardMacrosTricks
>
> How did I find those pages? Searched for "increment". HTH

Personally, I have a preference for using \, in a regexp replacement,
like

C-M-% [0-9]$ RET \,(1+ \#&) RET

Of course, this is glossing over the fact that there is no good way to
increase a 9.

And it requires a developer version of Emacs.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-10 15:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.5053.1155222256.9609.help-gnu-emacs@gnu.org>
2006-08-10 15:28 ` arithemtic in buffers David Kastrup
2006-08-10 13:44 Birju Prajapati
2006-08-10 15:03 ` Drew Adams

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.