projects
/
cookbook-data.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b9df3a4
)
Added despace.py for removing excessive blank lines
author
W. Trevor King
<wking@drexel.edu>
Wed, 21 Jul 2010 11:48:49 +0000
(07:48 -0400)
committer
W. Trevor King
<wking@drexel.edu>
Wed, 21 Jul 2010 11:48:49 +0000
(07:48 -0400)
misc/despace.py
[new file with mode: 0644]
patch
|
blob
diff --git a/misc/despace.py
b/misc/despace.py
new file mode 100644
(file)
index 0000000..
b7b6522
--- /dev/null
+++ b/
misc/despace.py
@@ -0,0
+1,12
@@
+import sys
+
+consecutive_blanks = 0
+for line in sys.stdin.readlines():
+ line = line.rstrip()
+ if len(line) == 0:
+ consecutive_blanks += 1
+ if consecutive_blanks <= 3:
+ print line
+ else:
+ consecutive_blanks = 0
+ print line