-2
I need to change the configuration of the Zabbix server that is in this directory C:\zabbix\conf\zabbix_agentd.win.conf
I need to replace the word: hostname=
for hostname=192.168.1.1
I did that, but the part below the hostname
I didn’t understand where to put the name to search and where to put the word that will replace it. I am using Python 3.6
import socket
import re
hostname = socket.gethostname()
with open('C:\zabbix\conf\zabbix_agentd.win.conf') as f:
for l in f:
s = l.split('*')
editar = re.sub(r"\b%s\b" % s[0] , s[1], editor)
And do you need Python for that? It’s not better to open the file in the editor and change?
– Woss
eh pq will run on several machines this script
– Estagiário
And you’ve tried to do something?
– Woss
yes the script is already ready, I just need to know some module and the command to search and replace the specific word
– Estagiário