Once upon a time, Mike Wright <nob...@nospam.hostisimo.com> said:
> I have a set of dns zone text files in "bind" format.  On the fourth
> line there is a 10 digit timestamp (ignoring white space, the first
> field).  There is no way to predetermine the value so search and
> replace by value is a no go and seems to require some positional
> approach such as "line 4, first 10 digit field".
> 
> What is the easiest way to replace each of them with the same value,
> $(date +%s) ?

The BIND zone file format is very unfriendly for easy script changes
unfortunately.

The easiest way (without a full parser) to do it is to find the existing
value by generating a well-known format of the file; for example,
named-checkzone (from bind-utils) can dump a "canonical" format of a
zone, which you can then grep out the SOA record and get the current
serial number.  Then you can do the basic search-and-replace approach,
although that can be a problem too (for example, 1 is a valid serial,
and you don't want to s/1/1234/ and replace all instances of "1").

-- 
Chris Adams <li...@cmadams.net>
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to