Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 13782  / 3 Years ago, mon, may 10, 2021, 1:50:30

how can i get "+45.0°C" if the following output was a file (http://paste.linuxthefish.net/4@raw)?



I can get it to one line by doing



sensors -A acpitz-virtual-0 > sen
grep temp1 ~/sen


but it still has a load of useless crap on it:



"temp1:        +42.0°C  (crit = +90.0°C)"

More From » grep

 Answers
7

Here's the answer:
For instance these are the texts inside the file



acpitz-virtual-0
Adapter: Virtual device
temp1: +45.0°C (crit = +90.0°C)
temp2: +45.0°C (crit = +90.0°C)


To get the +45.0°C of temp1, use this command:



grep temp1 < theFileWithTemp.txt | awk '{print $2}'

[#33432] Tuesday, May 11, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
naldis

Total Points: 257
Total Questions: 101
Total Answers: 111

Location: Kenya
Member since Sat, Feb 25, 2023
1 Year ago
;