summaryrefslogtreecommitdiff
path: root/uriprintf
blob: f79d067bad2c6d0264c67640bb0aadd097378f17 (plain) (blame)
1
2
3
4
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"