scripts icon indicating copy to clipboard operation
scripts copied to clipboard

Collapse sed/grep/awk pipeline to single awk invocation.

Open BasementTrix opened this issue 3 years ago • 2 comments

BasementTrix avatar Feb 17 '22 13:02 BasementTrix

I am not sure it works properly:

# ./sensors.AWK.sh

            BATTERY/AC/TIME/FAN/SPEED 
 ------------------------------------ 
             dev.acpi_ibm.0.fan_level: 0
             dev.acpi_ibm.0.fan_speed: 0
                   dev.acpi_ibm.0.fan: 0
                       hw.acpi.acline: 1
                 hw.acpi.battery.life: 100
                 hw.acpi.battery.time: -1
                hw.acpi.cpu.cx_lowest: C1

                  SYSTEM/TEMPERATURES 
 ------------------------------------ 
                dev.cpu.0.temperature: 48.0C (max: 100.0C)
      hw.acpi.thermal.tz0.temperature: 49.1C
                dev.cpu.1.temperature: 48.0C (max: 100.0C)
                dev.cpu.2.temperature: 46.0C (max: 100.0C)
                dev.cpu.3.temperature: 47.0C (max: 100.0C)
                dev.cpu.4.temperature: 48.0C (max: 100.0C)
                dev.cpu.5.temperature: 49.0C (max: 100.0C)
                dev.cpu.6.temperature: 48.0C (max: 100.0C)
                dev.cpu.7.temperature: 48.0C (max: 100.0C)

                   DISKS/TEMPERATURES 
 ------------------------------------ 
smartctl 7.2 2021-09-14 r5236 [FreeBSD 13.0-RELEASE-p6 amd64] 
Copyright  2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
SATA Version is:  SATA 3.2, 6.0 Gb/s 
Offline data collection status:         Offline data collection activity
Self-test execution status:             The previous self-test routine completed
data collection:                 seconds.
capabilities:                     SMART execute Offline immediate.
SMART capabilities:             Saves SMART data before entering
Error logging capability:               Error logging supported.
recommended polling time:         minutes.
recommended polling time:         minutes.
SCT capabilities:               SCT Status supported.
                       smart.ada0.190: 39.0C
Selective self-test flags :
smartctl 7.2 2021-09-14 r5236 [FreeBSD 13.0-RELEASE-p6 amd64] 
Copyright  2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
SATA Version is:  SATA 3.0, 6.0 Gb/s 
Offline data collection status:         Offline data collection activity
Self-test execution status:             The previous self-test routine completed
data collection:                 seconds.
capabilities:                     SMART execute Offline immediate.
SMART capabilities:             Saves SMART data before entering
Error logging capability:               Error logging supported.
recommended polling time:         minutes.
recommended polling time:         minutes.
Num  Test_Description    Status                  Remaining  LifeTime  LBA_of_first_error
Selective self-test flags :

vermaden avatar Feb 17 '22 17:02 vermaden

Hi.

There is also a difference in tolower() function between the two:

   (nvd*)
         '{MIB="smart." DISK "." tolower($1) ":"; printf("%38s %s.0C\n", MIB, $(NF-1))}'

    (*)
         '{MIB="smart." DISK "." tolower($2) ":"; printf("%38s %s.0C\n", MIB, $NF)}'

vermaden avatar Jul 11 '23 13:07 vermaden