configuration-templates – Blame information for rev 80

Subversion Repositories:
Rev:
Rev Author Line No. Line
80 office 1 #!/bin/sh
2 ###########################################################################
3 ## Copyright (C) Wizardry and Steamworks 2018 - License: GNU GPLv3 ##
4 ###########################################################################
5 # http://grimore.org/fuss/awk#convert_key-value_map_to_json #
6 ###########################################################################
7  
8 apcaccess | awk -F: '
9 function trim(s) {
10 return gensub(/^[ \t"]*|[ \t"]*$/, "", "g", s)
11 }
12 BEGIN {
13 printf "{"
14 }
15 NR > 1 {
16 printf(", ")
17 }
18 {
19 printf("\"%s\":\"%s\"", trim($1), trim(substr($0, index($0,":") + 1)));
20 }
21 END {
22 print "}"
23 }
24 '