Updating zone file serial numbers with sed

I made some mods to all my zone files just now (changed name servers) and needed to update all the serials as well. The name server change was easy enough:

# sed -i 's/from/to/g' db.*

But changing the serial is a little tricker. A serial number is in the form YYYYMMDDNN where NN is the update number for that day. So today would be 2006111100. This is the forumla:

# sed -i 's/200[0-9]\{7\}/2006111104/g' db.*

This says to replace any text starting with 200 and followed by 7 digits with 2006111104 . I should add this to the sed one liners page: http://sed.sourceforge.net/sed1line.txt
BTW, my high school web page is now on my servers.

This entry was posted in uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>