Incrementing a record number by 1 using grep?

2008-10-31 Thread glencoe

Is it possible to increment a sequence number automatically by 1?

I have an XML file that gets appended to throughout the year.

It contains a growing series of records, each with an ID numbered like
this:

Id444/Id

I can create most of the next record using a Text Factory (by copying
the previous record).

But I want to change the 444 to 445 so that the new record is
numbered:

Id445/Id

Any ideas?

Using BBEDit 9.0.2

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: Incrementing a record number by 1 using grep?

2008-10-31 Thread johndelacour

At 12:20 -0700 31/10/08, glencoe wrote:

Is it possible to increment a sequence number automatically by 1? ...

With a Unix Filter :


#!/usr/bin/perl
while () {
m~(Id)([0-9]+)(/Id)~;
$old_id = $2;
$new_id = $old_id + 1;
s~$old_id~$new_id~;
print;
}

JD

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: Incrementing a record number by 1 using grep?

2008-10-31 Thread David Glencoe


Thank you. Very helpful.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: how do we grep find NOT such-and-such literal *sequence* of chars

2008-10-31 Thread Govinda

Also I want to ask - is this BBEdit Talk group OK territory for these
kinds of grep Q's?
Of course if it is specific to BBedit then that is obvious, but is
there some more appropriate list/group to discuss regex behavior
(assuming the engine they discuss matches the behavior of BBedit's)?

-G
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---