On 10/17/18 11:04 AM, Mike Wright wrote:
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) ?

sed -i -e "4s/[0-9]\{10\}/$(date +%s)/" filename

Make sure you back up the files before trying this. You can also add an extension to the -i option to automatically make backups. You can also probably do all the files at once, but I haven't tested that.
_______________________________________________
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