fan_kickstart.py 326 B

12345678910111213
  1. #!/usr/bin/python
  2. import sys
  3. import re
  4. sea = re.compile("M106 S[1-9]+[0-9]*")
  5. rep = re.compile("M106 S255\n\g<0>")
  6. out = open(sys.argv[1]+"_fixed", 'w')
  7. with open(sys.argv[1]) as f:
  8. for r in f:
  9. if re.search(sea, r) is not None:
  10. out.write(re.sub(sea,"M106 S255\n\g<0>",r))
  11. else:
  12. out.write(r)