Using awk to remove plus signs and such

In need of some awk help.

This is the output of sensors:

Adapter: ISA adapter
Core 0:       +50.0°C  (high = +80.0°C, crit = +90.0°C)
Core 2:       +47.0°C  (high = +80.0°C, crit = +90.0°C)

I can use awk and cut to get the temperature only for each core as: +50.0°C

What I want is to get the output as 50°C or 50.0°C.

In the past I have used gsub or sub for that, but it’s been a while and I can’t remember how I did it.

Any help with that appreciated.

sensors | awk '/Core/{gsub("+","");print $3}'
1 Like


Next time I sit for tea with the Queen, I’ll see about getting you knighted.
And by Queen, I mean my cat. She’s pretty much in charge around here.

1 Like

Well @PackRat it’s a good thing she loves you. You would be her dinner by now! With psuedoname of PackRat that is. Lol