Alter file name and JSON structure in transfer-data.sh
This commit is contained in:
parent
179622ca2f
commit
830414d37c
@ -5,13 +5,15 @@ TTD="10"
|
||||
KEY="ZGVmaW5tYUB0MzhiYmNjZDE2MjE3NDViODgxMTk5ZGI2ZWQzZGFiNmE6RGVGaW5NYWNoZW4yMDIwIQ=="
|
||||
|
||||
# Build name
|
||||
NAME=${1##*/}
|
||||
# Basename of file with the last dot replaced by a slash and .DPT extension
|
||||
NAME=$(basename $1)
|
||||
NAME="${NAME%.*}_${NAME##*.}.DPT"
|
||||
|
||||
# Build body
|
||||
JSON="{\"$NAME\": ["
|
||||
JSON="{\"filename\":\"$NAME\",\"dpt\":["
|
||||
while read LINE
|
||||
do
|
||||
JSON+="[${LINE%,*}, ${LINE#*,}], "
|
||||
JSON+="[\"${LINE%,*}\",\"${LINE#*,}\"], "
|
||||
done < $1
|
||||
JSON=${JSON::-2}
|
||||
JSON+=']}'
|
||||
|
Loading…
Reference in New Issue
Block a user