diff options
-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 | } | ||