Conky cosmetic - a little scripting question.

a very small Live CD shaped to look and act like Puppy Linux.

Moderator: fredx181

Post Reply
dcung
Posts: 471
Joined: Fri Sep 25, 2020 4:31 am
Has thanked: 57 times
Been thanked: 67 times

Conky cosmetic - a little scripting question.

Post by dcung »

Most of my laptops, pcs, I find to get better picture of temp from reading CPU core.
So, I have this line in generic conky setup that reads it - from sensors command.

Code: Select all

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +38.0°C  (high = +87.0°C, crit = +105.0°C)
Core 0:        +39.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1:        +32.0°C  (high = +87.0°C, crit = +105.0°C)

CMB1-acpi-0
Adapter: ACPI interface
in0:          12.20 V  
curr1:         0.00 A 

sensors | grep ^"Core 0" | awk '{print $3}'

Code: Select all

+39.0°C

I want to get rid of the +
How do I do that pls?

User avatar
MochiMoppel
Posts: 1236
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 439 times

Re: Conky cosmetic - a little scripting question.

Post by MochiMoppel »

dcung wrote: Sun Oct 27, 2024 2:24 am

sensors | grep ^"Core 0" | awk '{print $3}'

Code: Select all

+39.0°C

I want to get rid of the +

You don't need grep when you use awk.
Try

Code: Select all

sensors | awk '$1$2=="Core0:" {print substr($3,2)}'
dcung
Posts: 471
Joined: Fri Sep 25, 2020 4:31 am
Has thanked: 57 times
Been thanked: 67 times

Re: Conky cosmetic - a little scripting question. <SOLVED>

Post by dcung »

MochiMoppel wrote: Sun Oct 27, 2024 3:41 am

You don't need grep when you use awk.
Try

Code: Select all

sensors | awk '$1$2=="Core0:" {print substr($3,2)}'

That works!
Thanks @MochiMoppel

Post Reply

Return to “DebianDogs”