]> diplodocus.org Git - nmh/commitdiff
Try this sed command for squeeze_lines().
authorDavid Levine <levinedl@acm.org>
Sun, 8 Dec 2013 18:15:18 +0000 (12:15 -0600)
committerDavid Levine <levinedl@acm.org>
Sun, 8 Dec 2013 18:15:18 +0000 (12:15 -0600)
test/common.sh.in

index 94b41906c791902b61ef97781065968e7b32aee0..8f5d576cced1f7d33ed12d8924f3cc23edcadf92 100644 (file)
@@ -126,11 +126,11 @@ check_for_hard_links () {
   set -e
 }
 
-#### Filter that squeezes blank lines, emulating GNU cat -s.
+#### Filter that squeezes blank lines, partially emulating GNU cat -s,
+#### but sufficient for our purpose.
+#### From http://www-rohan.sdsu.edu/doc/sed.html, compiled by Eric Pement.
 squeeze_lines() {
-  awk 'length($0) == 0 && e == 1 { next }
-          { e = length($0) == 0 }
-          { print }'
+  sed '/^$/N;/\n$/D'
 }
 
 #### Filter that inserts initial whitespace and converts non-breakable