stockholm/bin/bre-invert-word
2015-05-21 01:56:08 +02:00

16 lines
239 B
Bash
Executable File

#! /bin/sh
# bre-invert-word : string -> BRE
set -euf
# TODO escape chars in the resulting BRE.
awk -v input="$1" '
BEGIN {
split(input,s,"")
for (i in s) {
c=s[i]
printf "\\|%s[^%s]", y, c
y = y c
}
}
'