aboutsummaryrefslogtreecommitdiff
path: root/contrib/removetrailingwhitespace
blob: 9e620cbb2639d1989aed04d07c22dbfdb6473992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/python

import sys
import re

for fileName in sys.argv[1:]:
   f = open(fileName, 'r+')
   fileString = f.read()

   fileString = re.sub(r'[ ]+\n', r'\n', fileString)
   fileString = re.sub(r'\r', r'', fileString)
   f.seek(0)
   f.write(fileString)
   f.truncate(len(fileString))