Updating zone file serial numbers with sed

published on 2006-11-11 in computing

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.

Tags: sed bind linux