Quote:
Originally Posted by kverma1985
Code:
df -k | awk '$1~/^\/dev\//{keep="y"}NF==1{arg1==$1}NF==5{if(keep="y")print arg1,$0;keep="n"}NF==6{if(keep=="y")print;keep="n"}'
|
The only other thing I see that doing is, in a rather convoluted way, suppressing the header line. Rewriting as multiple lines and adding comments:
Code:
$1~/^\/dev\//{keep="y"} # If the first field contains "/dev/" set keep to "y"
NF==1{arg1==$1} # If there is just 1 field, save it as the device path
NF==5{if(keep="y")print arg1,$0;keep="n"} # If 5 fields and "/dev/" was seen, print the device
# path and the current line
NF==6{if(keep=="y")print;keep="n"}' # If 6 fields and "/dev/" present, print the line
It ignores any line without a contained "/dev/" string or a preceding "/dev/" string that was not already printed.
It's a rather complex substitute for
Code:
df -P -k | grep /dev/