#!/bin/bash #fin=(ParkingGR.xlsx.json Greece Trnasportation) file_in="./Data/citadel.csv" file_out="./Data/citadel.xml" function element() { h3=${h7//\"/$h5} h3=${h3#*$1+:+} h3=${h3%%+*} echo "<$2>${h3}" >> $file_out } IFS="*" while read link country waze osm comment do echo $link file_name=/home/cerba/Temp/${link##*/} #echo $file_name echo $country echo $waze file_out="/home/cerba/Temp/temporary.xml" #file_out="/home/cerba/Temp/"${comment}'.xml' #echo $file_out #cd /home/cerba/Temp/ wget -P /home/cerba/Temp/ --output-document=/home/cerba/Temp/temporary1.json ${link} sed -r 's/&+/&/g' /home/cerba/Temp/temporary1.json > /home/cerba/Temp/temporary.json #awk 'BEGIN { FS="&"; OFS="and" } {$1=$1; print}' /home/cerba/Temp/temporary1.json > /home/cerba/Temp/temporary.json echo '' > $file_out echo '' >> $file_out input=${file_name[0]} #read -r line < ${file_name[0]} read -r line < /home/cerba/Temp/temporary.json h1="*" h5="+" line=${line//'},{'/$h1} line=${line//':[{'/$h1} IFS='*' read -r -a array <<< "$line" echo ${array[0]} h7=${array[0]//\"/$h5} idset=${h7%%,*} echo $id idset=${idset##*:} echo $id echo ''${h3}'' >> $file_out for ((i=1; i < ${#array[@]}; i++)) do echo '' >> $file_out echo ''$idset'' >> $file_out h7=${array[i]//\"/$h5} element id id element title label element value addr_city element posList coord echo '' >> $file_out done echo '' >> $file_out java -Djava.io.tmpdir=/media/cerba/Data/Temp -Xms2560m -Xmx24560m -jar saxon9he.jar -s:/home/cerba/Temp/temporary.xml -xsl:../XSLT/transform_citadel.xsl -o:/media/cerba/Data/Data/SPOI/RDF_output/${comment}_Citadel.rdf -t done < $file_in