From: W. Trevor King Date: Wed, 21 Jul 2010 11:48:49 +0000 (-0400) Subject: Added despace.py for removing excessive blank lines X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=994e527b23f376c785b8d37b048cdbd12ff52df7;p=cookbook-data.git Added despace.py for removing excessive blank lines --- diff --git a/misc/despace.py b/misc/despace.py new file mode 100644 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