It should not be too hard. Since you have such a rock solid format, you can safely assume in your case, the last 2 digits are ints always, always 2 digits long.

Just find the string of chars you are interested in, and substring the last two. Now you have a number (int) and you can use a little math to +1 to it.

The only area you have to be careful in, depending on the language, is 01 to 09 where the leading zero is going to get lost. You could use a string pad left function to put a zero in, or in this case, just check the string length, if it is one, concatenate a zero in front.

On Mar 24, 2009, at 1:57 PM, Todd Snyder wrote:

I am looking for a clever way to do the new serial number. Date will do
the first bit no problem (date +%Y%m%d), but I'd love to find a clever
way to auto increment the last 2 digits unless it's a new day.  Then I
could use the same script every time.

--
Scott * If you contact me off list replace talklists@ with scott@ *

_______________________________________________
bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Reply via email to