4 ms·
You don't even need the 'smartStats' temporary file at all, since you can do that with just one grep: smartctl -a /dev/sda | grep '\(Reallocated_Sector_C
by caf 10y ago
You don't even need the 'smartStats' temporary file at all, since you can do that with just one grep:
smartctl -a /dev/sda |
grep '\(Reallocated_Sector_Ct\|Current_Pending_Sector\|Offline_Uncorrectable\|UDMA_CRC_Error_Count\)' > /root/stats
- twr 10y agoawk is probably better in this case, since you can save only the raw values (and other columns that you deem important): awk '/Reallocated_Sector_Ct|Current_Pending_Sector|Offline_Uncorrectable|UDMA_CRC_Error_Count/ {print $2,$10}'