diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-08-29 10:15:57 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-08-29 10:15:57 +0000 |
commit | 1d1331d46726122a7a0f705b9a28b87e02712022 (patch) | |
tree | 3da40481bb661bd72bdb7dda99732326c3543438 | |
parent | 8fbe5fee60ad2d592f4729c994df3c182015395e (diff) |
script to remove whitespace at the end of a line
git-svn-id: https://gnunet.org/svn/gnunet@16619 140774ce-b5e7-0310-ab8b-a85725594a96
-rwxr-xr-x | contrib/removetrailingwhitespace | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/removetrailingwhitespace b/contrib/removetrailingwhitespace new file mode 100755 index 0000000000..9e620cbb26 --- /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)) |