Sep 4, 2008

comma delimited fs info in unix

use the following to generate comma delimited output of filesystem sizes in unix.

df -k | sort -n | grep -v Filesystem | awk '{print $6","$2","$3","$4","$5}'

where
sort -n sorts but actually gets rid of double lines
grep -v removes the original heading from the output
awk prints the output in comma format and the information that you want.