Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. kleuren(){
  2. temp=$(echo ${1%.*}_temp.${1##*.})
  3. style=$(echo ${2%.*}_temp.${2##*.})
  4. cp $1 $temp
  5. sed '/^[^A-Z]/d' $2 | sed '/^$/d' > $style
  6.  
  7. while read p; do
  8. match=$(cut -d "," -f1 <<<$p)
  9. color=$(cut -d "," -f2 <<<$p)
  10. sed -r "s/"$match"\"/"$match"\" style\=\"fill\:"$color"\;\"/g" $temp > $temp.tmp && mv $temp.tmp $temp
  11. done <$style
  12.  
  13.  
  14.  
  15. convert svg:$temp png:${1%.*}.png
  16. rm -f $temp $style
  17. }
  18.  
  19.  
  20. Syntaxis(){
  21. >&2 echo "Fout: onbestaand, onleesbaar of ongeldig" $2"-bestand:" $1
  22. >&2 echo "Syntaxis: inkleuren svg-bestand csv-bestand"
  23. }
  24.  
  25.  
  26. case $1 in
  27. *.svg)
  28. case $2 in
  29. *.csv)
  30. kleuren $1 $2;;
  31. *)
  32. Syntaxis $2 csv; exit 3;;
  33. esac;;
  34. *)
  35. case $2 in
  36. *.csv)
  37. Syntaxis $1 svg; exit 2;;
  38. "")
  39. >&2 echo "Syntaxis: inkleuren svg-bestand csv-bestand"; exit 1;;
  40. *)
  41. Syntaxis $2 csv ;;
  42. esac;;
  43. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement