summaryrefslogtreecommitdiff
path: root/printfurl
blob: 91fd38871d74bb6e792869b02261abe369fd587a (plain) (blame)
1
2
3
4
5
#!/bin/sh
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"