I am looking to create a python script that will read one source file then produce another file with a string for the name.
for example
macaddress.cnf.xml contains the source file
I need to change '6000' to '6001' in multiple places of macaddress.cnf.xml, then I want to output to newmacaddress.cnf.xl.
This is what I have
#! /usr/bin/python
#read and write to file
f = open(file)
for line in f:
if line.contains('66001'):
newline = line.replace('66001', '60001')
To add I would like to be able to do this with a csv or whatever and have the script run through and do
60002 >> macaddressfromcsv.cnf.xml 60003 >> macaddressfromcsv.cnf.xml 60004 etc.
Sorry I am very new to this any help would be great.