Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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