fhutt
|
2013-11-12
, 22:55
|
Posts: 49 |
Thanked: 8 times |
Joined on Oct 2013
|
#1
|
|
2013-11-13
, 03:00
|
Posts: 49 |
Thanked: 8 times |
Joined on Oct 2013
|
#2
|
|
2013-11-13
, 09:18
|
Posts: 230 |
Thanked: 302 times |
Joined on Oct 2009
@ Helsinki, Suomi (Finland)
|
#3
|
$ (sleep 20 && bmestat | grep "battery current" > idle_current.txt &)
$ cat idle_current.txt
|
2013-11-13
, 10:04
|
Posts: 49 |
Thanked: 8 times |
Joined on Oct 2013
|
#4
|
|
2013-11-13
, 10:49
|
Community Council |
Posts: 4,920 |
Thanked: 12,867 times |
Joined on May 2012
@ Southerrn Finland
|
#5
|
Thanks ladoga. This gives the result I need, but I would like it in a script without saving the result in a file.
I tried:
(bmestat | grep "battery current")
This gave me:
battery current: -213
I had the phone charging at the time. How do I now extract just the result (-213)?
Thanks
|
2013-11-13
, 11:19
|
Posts: 49 |
Thanked: 8 times |
Joined on Oct 2013
|
#6
|
|
2013-11-13
, 22:21
|
Posts: 49 |
Thanked: 8 times |
Joined on Oct 2013
|
#7
|
|
2013-11-14
, 04:28
|
Posts: 49 |
Thanked: 8 times |
Joined on Oct 2013
|
#8
|
|
2013-11-14
, 06:21
|
Community Council |
Posts: 4,920 |
Thanked: 12,867 times |
Joined on May 2012
@ Southerrn Finland
|
#9
|
Maybe this line:
current = ((bmestat | grep "battery current") | awk '{print $3}' )
is too complicated for someone like me, who knows very little about sh or python.
But maybe split the job up into 3 smaller pieces would be easier:
#!/bin/sh
#Place the output of bmestat into string bmestring
bmestring = bmestat
#Extract the 'battery current' element out of the string in bmestring
element = ($bmestring | grep "battery current")
#Extract the numeric value out of element
current = ($element | awk '{prit $3}')
echo -n $current
Now you can see my lack of knowledge.
Maybe it would be easier in python.
Can someone please help put me out of my misery with this?
Thanks
The Following User Says Thank You to juiceme For This Useful Post: | ||
|
2013-11-14
, 07:11
|
Posts: 49 |
Thanked: 8 times |
Joined on Oct 2013
|
#10
|