I need some help tweaking my code to look for another attribute in this unix df output:
Ex.
Filesystem Size Used Avail Capacity
Lots of variations on a theme here. I would keep the first line, since it gives a nice header:
$ perl -E '$,=" "; open my $fh, "-|", "df -k /tmp";
while(<$fh>) { @a=split; say @a[3,4]}'
On second thought, this is a lot cleaner:
$ df -k /tmp | perl -naE '$,="\t"; say @F[3,4]' Available Capacity 20862392 92%
Final thought: don't use perl at all:
$ df -h /tmp | tr -s ' ' '\t' | cut -f 3,4
or
$ df -h /tmp | awk '{print $3 "\t" $4}'