Hey Nation :-)
So here's a challenge for the scripting guru's...
I'm trying to write an EA for getting the Design Capacity for a built-in Intel MacBook Pro battery.
So far I have this script:
/usr/sbin/ioreg -r -c "AppleSmartBattery" | /usr/bin/grep -w "DesignCapacity" | /usr/bin/awk '{print $3}'
But this yields me waaaaaay too much info and the required awk value is on it's own new line right at the bottom.
The body of the result output does contain the "DesignCapacity" value mixed in among hundreds of other values!
So my challenge is... how do I get rid of all that extra value output to just have the final line output?
eg:
me@MacBookPro ~ % /usr/sbin/ioreg -r -c "AppleSmartBattery" | /usr/bin/grep -w "DesignCapacity" | /usr/bin/awk '{print $3}'
gives this result:
{"PMUConfigured"=0,"FccComp2"=5050,"ResScale"=133,"SystemPower"=1051098690,"Qmax"=(5496,5497,5510),"DesignCapacity"=5103,"CellVoltage"=(4169,4169,4169),"PassedCharge"=26,"RaTableRaw"=(<00550070005f007300780084006c0074007c007f0082007a009000da0179024e>,<000000650055006100660072005d0065006c007100760072008800ca0168022f>,<0000006c005c006e0073007e0067006e00760079007c0074008a00d20173023e>),"StateOfCharge"=88,"PresentDOD"=(12,12,12),"Flags"=557318657,"DataFlashWriteCount"=3462,"DOD0"=(2080,2096,2080),"ChemID"=9216,"AdapterPower"=0,"CycleCount"=9,"Voltage"=12511,"GaugeFlagRaw"=192,"FccComp1"=5168,"BatteryState"=<000000000000000043e4000202000000>,"ManufactureDate"=52987870328882,"LifetimeData"={"TotalOperatingTime"=14205,"UpdateTime"=1664774348,"AverageTemperature"=0,"TimeAtHighSoc"=<58000000cb0100000300000000000000>},"Serial"="F5D01130MLSKGGJBB"}
5103
me@MacBookPro ~ %
(the number "5103" is the value I am after...)
Thanks y'awl for any help and comments - but be gentle... it's my first post! :-)