Skip to content

Instantly share code, notes, and snippets.

@hplc
Created December 2, 2011 03:11
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 hplc/1421562 to your computer and use it in GitHub Desktop.
Save hplc/1421562 to your computer and use it in GitHub Desktop.
Find apache httpd access_log in current directory and count today's ouput bytes
#!/bin/sh
echo Today is: `date +%d/%b/%Y`
for file in `ls *access_log`
do
grep `date +%d/%b/%Y` $file | \
awk '
{
gsub(/:/, " ")
# print $14
s+=$14
}
END {
printf "%.2f GB ", s/1024/1024
}
'
echo $file
done | sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment