aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-08-08 10:45:17 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-08-08 10:45:17 +1200
commit94ad9332c0a8213ad384007707d68ac8fd1810cb (patch)
tree3c5993a3f987f6f8576af13f604d792288c4d785 /bin
parentRestore ^L-skipping code (diff)
downloaddotfiles-94ad9332c0a8213ad384007707d68ac8fd1810cb.tar.gz
dotfiles-94ad9332c0a8213ad384007707d68ac8fd1810cb.zip
Nicer handling of RFC control chars
Diffstat (limited to 'bin')
-rw-r--r--bin/rfct.awk11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/rfct.awk b/bin/rfct.awk
index 5ceef43f..230ac42c 100644
--- a/bin/rfct.awk
+++ b/bin/rfct.awk
@@ -6,9 +6,12 @@ BEGIN {
ORS = "\n\n"
}
-# Skip paragraphs with ^L chars in them
-# We have to be literal here due to mawk's failures
-/ / { next }
+# Skip paragraphs with ^L chars in them, as they likely contain headers and
+# footers
+/\f/ { next }
-# If there's anything left, print it
+# Strip out other control characters, but allow newline and tab
+{ gsub(/[\a\b\r\v]/, "") }
+
+# If there's anything left after tha, print it
length($0)