1.python
http://blog.chinaunix.net/uid-25602770-id-4009387.html
2.ruby
https://my.oschina.net/moluyingxing/blog/192248
Dir.glob('**/*').each do |file| next unless /.m$/ =~ file or /.h$/ =~ file # Only Objective C code. next if /^ZergSupport/TestSupport/GTM// =~ file # Skip GTM code. next if /^ZergSupport/TestSupport/OCMock// =~ file # Skip OCMock code. contents = File.read file # eat whitespace at the end of lines contents.gsub! /[ ]+$/, "" # tabs are 2 spaces contents.gsub! " ", " " # force -(type)method instead of - (type) method contents.gsub! /-s*(([^(]*))s*(w)/, "-(\1)\2" contents.gsub! /+s*(([^(]*))s*(w)/, "+(\1)\2" # force methodName:(type)argument instead of methodName: (type)argument contents.gsub! /(w+):[ ]*(/, "\1:(" # license contents.gsub! '__MyCompanyName__', 'Zergling.Net' contents.gsub! /^// Copyright.*Zergling.Net. .*.$/, "// Copyright Zergling.Net. Licensed under the MIT license." File.open(file, 'w') { |f| f.write contents } end