Skip to content

Instantly share code, notes, and snippets.

@phact
Created February 3, 2016 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phact/4c0a9a9144533313f44f to your computer and use it in GitHub Desktop.
Save phact/4c0a9a9144533313f44f to your computer and use it in GitHub Desktop.
#!/bin/bash
dt=`date +%D`
log="du.log"
df > /tmp/du$$
while read line
do
fields=`echo $line | awk '{print NF}'`
case $fields in
5) echo -n "$dt " >> $log
echo $line | awk '{print $5,$4}' >> $log;;
6) echo -n "$dt " >> $log
echo $line | awk '{print $6,$5}' >> $log;;
9) echo -n "$dt " >> $log
echo $line | awk '{print $8,$9}' >> $log;;
10) echo -n "$dt " >> $log
echo $line | awk '{print $9,$10}' >> $log;;
esac
done < /tmp/du$$
rm /tmp/du$$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment