From 994e527b23f376c785b8d37b048cdbd12ff52df7 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 21 Jul 2010 07:48:49 -0400 Subject: [PATCH] Added despace.py for removing excessive blank lines --- misc/despace.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 misc/despace.py 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 -- 2.26.2