summaryrefslogtreecommitdiff
path: root/printfurl
diff options
context:
space:
mode:
Diffstat (limited to 'printfurl')
-rwxr-xr-xprintfurl8
1 files changed, 4 insertions, 4 deletions
diff --git a/printfurl b/printfurl
index 3da61a6..91fd388 100755
--- a/printfurl
+++ b/printfurl
@@ -1,5 +1,5 @@
#!/bin/sh
-cutargs="$(printf "%s\n" "$1" | tr '%' '\n' | tail -n+2 | sed 's/^\(.\).*/-\1/g')"
-printfargs="$(printf "%s\n" "$1" | sed 's/%./%s/g')"
-#printf "printfargs: %s\n" "$printfargs"
-cuturl $cutargs | tr '\n' ' ' | xargs -L1 printf "$printfargs"
+cutargs="$(printf "%s\n" "$1" | tr '%' '\n' | tail -n+2 | grep '^[sukdPpqfU]' | sed 's/^\(.\).*/-\1/g')"
+count="$(echo $cutargs | tr '-' '\n' | grep -c .)"
+printfargs="$(printf "%s\n" "$1" | sed 's/%[sukdPpqfU]/%s/g')"
+cuturl "$cutargs" | tr '\n' '\0' | xargs -n $count -0 printf "$printfargs"