Comment

Comment by JayGuerette

My pet peeve, grep unnecessarily followed by awk/sed.

Original: df -h | grep "$partition" | awk '{print $5}' | sed 's/%//'

Efficient: df -h | grep -Po "\d+(?=%\s+$partition)"

parent JayGuerette 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton