cat /proc/acpi/battery/C1AC/state | grep "present voltage" |$3 in awk means it only prints the third column. The value of first column is string "present" and the second one is "voltage" or "rate" in current value. This command will print the exact value only without obstacles. Enjoy!
awk '{print $3}'
cat /proc/acpi/battery/C1AC/state | grep "present rate" |
awk '{print $3}'
Sunday, April 10, 2011
[Linux Ubuntu] Getting Exact Value of Voltage and Current
We are now one step closer to measuring power process. In the previous explanation, we have got voltage and current value but it still has some obstacles. I mean, there are string "present voltage:" and "present rate" in voltage and current value, respectively. How can we remove them? We employ grep to get certain line and we can use awk get certain column of one line output.
Labels:
Ubuntu Power Consumption
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment