Archive for the ‘bash’ Category
Various bash
# last filed zcat access.log.gz |grep 27/Jan/2008 |awk ‘{ field = $NF }; {print field}’ # count per Hits zcat access.log.gz |grep 27/Jan/2008 |awk ‘{ field = $NF }; {print “Host: ” field } ‘ | sort |uniq -c # count per Hits + Totale al fondo cat nomefile |grep “27/Jan/2008:” |awk ‘ { field [...]
Read the rest of this entry »Count domain in mail.log (Qmail)
# cat /usr/local/sbin/count_mail_per_domain.sh #!/bin/bash logfile=$2 domain=$3 case “$1″ in -t) cat $logfile |grep “to remote” | awk ‘{print $14}’ | awk -F@ ‘{ field = $2 }; {print “domain: ” field }’ | sort |uniq -c |sort -nr | awk -v totale=0 ‘{totale=totale+$1; print ;} END {print “Totale giorno domini: “totale;}’ ;; -su) cat $logfile [...]
Read the rest of this entry »