summaryrefslogtreecommitdiff
path: root/uriprintf
diff options
context:
space:
mode:
Diffstat (limited to 'uriprintf')
-rwxr-xr-xuriprintf5
1 files changed, 5 insertions, 0 deletions
diff --git a/uriprintf b/uriprintf
new file mode 100755
index 0000000..f79d067
--- /dev/null
+++ b/uriprintf
@@ -0,0 +1,5 @@
+#!/bin/sh
+cutargs="$(printf "%s\n" "$1" | sed 's/%[^sukdPpqfU]//g' | tr '%' '\n' | tail -n+2 | sed 's/^\(.\).*/-\1/g' | tr '\n' ' ')"
+count="$(echo $cutargs | tr '-' '\n' | grep -c .)"
+printfargs="$(printf "%s\n" "$1" | sed 's/%[sukdPpqfU]/%s/g')"
+uricut "$cutargs" | tr '\n' '\0' | xargs -n $count -0 printf "$printfargs"