Home > awk, bash > tips&tricks

tips&tricks

March 25th, 2008

 Powered by Max Banner Ads 

# 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 = $NF }; {print "Host: " field }' | sort|uniq -c|sort -nr|awk -v totale=0 '{totale=totale+$1; print ;} END {print "Totale giornaliero: "totale;}'

awk, bash

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.