$ awk -F'(^|:) *' '{f[$2]=$3} END{print f["voltage"]}' file
4008
$ awk -F'(^|:) *' '{f[$2]=$3} END{print f["Max charging voltage"]}' file
0
$ awk -F'(^|:) *' '{f[$2]=$3} END{print f["status"], f["health"], f["scale"]}' file
3 2 100
или для создания CSV из всех полей (например, для импорта в Excel):
$ awk -F'(^|:) *' -v OFS=',' '
{ keys[NR]=$2; vals[$2]=$3 }
END {
for (i=2; i<=NR; i++) {
printf "%s%s", keys[i], (i<NR ? OFS : ORS)
}
for (i=2; i<=NR; i++) {
printf "%s%s", vals[keys[i]], (i<NR ? OFS : ORS)
}
}
' file
AC powered,USB powered,Wireless powered,Max charging current,Max charging voltage,Charge counter,Overload,USB overheat,Extension,PowerJacketExist,PowerJacketStatus,PowerJacketLevel,PluginStatus,Unsupport Charger,status,health,present,level,scale,voltage,temperature,technology,mLedLogType,CutoffVoltage
false,false,false,0,0,2208619,false,false,0,false,0,0,false,false,3,2,true,71,100,4008,340,Li-ion,-1,0