Files
quectel-rgmii-toolkit/scripts/tojson.sh
iamromulan 5aaa75d1b6 Initial Combination
Start the combination process between:

d3505230f6

and the at-telnet portion of

39c20b83b1
2023-09-19 23:13:43 -04:00

22 lines
493 B
Bash

#!/bin/bash
# sarav (hello@grity.com)
# convert key=value to json
# Created at Gritfy ( Devops Junction )
#
file_name=$1
last_line=$(wc -l < $file_name)
current_line=0
echo "{"
while read line
do
current_line=$(($current_line + 1))
if [[ $current_line -ne $last_line ]]; then
[ -z "$line" ] && continue
echo $line|awk -F'=' '{ print " \""$1"\" : "$2","}'|grep -iv '\"#'
else
echo $line|awk -F'=' '{ print " \""$1"\" : "$2""}'|grep -iv '\"#'
fi
done < $file_name
echo "}"