From f99829be0bb1eaf89d0fd29afbee08d95d07d0a2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 2 Jun 2017 23:49:05 +1200 Subject: Remove regex operations on mi5(1df) delims --- bin/mi5.awk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/mi5.awk b/bin/mi5.awk index 82c5f914..27974274 100644 --- a/bin/mi5.awk +++ b/bin/mi5.awk @@ -38,7 +38,7 @@ mac && NF { dst = "" # As long as there's a pair of opening and closing tags - while (src ~ open ".*" shut) { + while (index(src,open)) { # Read up to opening tag into seg, shift from src ind = index(src, open) @@ -51,12 +51,12 @@ mac && NF { # Read up to closing tag into seg, shift from src ind = index(src, shut) - seg = substr(src, 1, ind + length(shut) - 1) + seg = substr(src, length(open) + 1, ind - length(shut) - 1) src = substr(src, ind + length(shut)) # Translate tags to quote open and close and add to dst - sub("^" open " *", "'", seg) - sub(" *" shut "$", "`", seg) + sub(/^ */, "'", seg) + sub(/ *$/, "`", seg) dst = dst seg } -- cgit v1.2.3