From: Christian Grothoff Date: Mon, 29 Aug 2011 10:15:57 +0000 (+0000) Subject: script to remove whitespace at the end of a line X-Git-Tag: initial-import-from-subversion-38251~17304 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bb4fc4f4007988874f910d4de5492f9629301641;p=oweals%2Fgnunet.git script to remove whitespace at the end of a line --- diff --git a/contrib/removetrailingwhitespace b/contrib/removetrailingwhitespace new file mode 100755 index 000000000..9e620cbb2 --- /dev/null +++ b/contrib/removetrailingwhitespace @@ -0,0 +1,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))