Showing posts with label AWK. Show all posts
Showing posts with label AWK. Show all posts

Saturday, June 16, 2012

Viewing file systems that 90% and more using awk & sed

This works with AIX
df -g | egrep -v "Filesystem|proc|tmp" | sed 's/\%//' | awk '$4 >= 90 {print $4 "%\t" $7}'
df -k | sed 1d | awk '$4>90 {print}'
This works with Solaris and Linux
df -k | egrep -v "proc|fd|cdrom|mnttab|run|tmp|Filesystem" | sed 's/\%//' | awk '$5 >= 90 {print $5 "%\t" $6}'

Saturday, February 5, 2011

AWK code fragment to kill process with unknown PID

AWK code fragment to kill process with unknown PID

# ps -ef | grep process | grep -v grep | awk '{system("kill -9 " $2)}'