diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-06-02 23:49:05 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-06-02 23:49:05 +1200 |
commit | f99829be0bb1eaf89d0fd29afbee08d95d07d0a2 (patch) | |
tree | ccdf7e1904120012283d2b2ef592ed51a728e0bd /bin | |
parent | Allow custom delimiters for mi5(1df) (diff) | |
download | dotfiles-f99829be0bb1eaf89d0fd29afbee08d95d07d0a2.tar.gz dotfiles-f99829be0bb1eaf89d0fd29afbee08d95d07d0a2.zip |
Remove regex operations on mi5(1df) delims
Diffstat (limited to 'bin')
-rw-r--r-- | bin/mi5.awk | 8 |
1 files 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 } |