X-Git-Url: http://git.plutz.net/?p=serve0;a=blobdiff_plain;f=multitag.sh;h=20b39391f9db1a9c103cda521c8ac145df334e33;hp=8b60adebb1ac8e265866f00570c47d124c0ca9e3;hb=02812995d1df8b60f702be2ec8cf807782a7ab35;hpb=1902cbbff7f9728f303cdb5e3fc37b18eddff4db diff --git a/multitag.sh b/multitag.sh index 8b60ade..20b3939 100644 --- a/multitag.sh +++ b/multitag.sh @@ -17,13 +17,18 @@ for select in $(seq 1 $(POST_COUNT select)); do read -r length width height tags comment fn <<-EOF $(meta_info "$file") EOF - tags="$(UNSTRING "${tags#tags=}" |tr , '\n')" if [ ! "$deltags" ]; then + extags="$(printf '%s' "$newtags" |tr , '\n' |grep -e "^-" |cut -d: -f1 )" + tags="$(UNSTRING "${tags#tags=}" |tr , '\n' |grep -vwFe "$extags")" + if printf %s "$extags" |grep -vq :; then + tags="$(printf %s\\n "$tags" |grep -vE '^-[^:]+$')" + fi tags="$(printf '%s\n' "${tags},${newtags}" \ | tr , '\n' |sort -u |tr '\n' , \ | STRING)" else + tags="$(UNSTRING "${tags#tags=}" |tr , '\n')" detag="${deltags},"; while [ "$detag" ]; do tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%,*}")" detag="${detag#*,}"