diff options
author | Case Duckworth | 2022-07-20 12:50:27 -0500 |
---|---|---|
committer | Case Duckworth | 2022-07-20 12:50:27 -0500 |
commit | b7cc61f40e8247e8874c9e4e26052cc410e7c570 (patch) | |
tree | b33bcc16984effb8a4014add414cf083c8386938 | |
download | k7r-main.tar.gz k7r-main.zip |
-rwxr-xr-x | k7r | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/k7r b/k7r new file mode 100755 index 0000000..3827e85 --- /dev/null +++ b/k7r | |||
@@ -0,0 +1,18 @@ | |||
1 | #!/bin/awk -f | ||
2 | #k7r: k8serizer | ||
3 | { | ||
4 | split($0, words, FS) | ||
5 | for (w in words) { | ||
6 | printf "%s ", k8serize(words[w]) | ||
7 | } | ||
8 | printf "\n" | ||
9 | } | ||
10 | |||
11 | |||
12 | function k8serize(word) | ||
13 | { | ||
14 | if (! match(word, /.(.*)./)) { | ||
15 | return (word "0") | ||
16 | } | ||
17 | return (substr(word, 1, 1) (RLENGTH - 2) substr(word, RSTART + RLENGTH - 1)) | ||
18 | } | ||