The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #13 (permalink)  
Old 05-17-2008
ripat ripat is offline
Registered User
 

Join Date: Oct 2006
Location: Belgium
Posts: 171
Quote:
Originally Posted by radoulov View Post
Another one
(use nawk or /usr/xpg4/bin/awk on Solaris):

Code:
awk -F'[: ]' 'END {
fmt = "%-20s\t%s\t%s\n"
printf fmt, "Page:", "Hits", "Unique Hits"
for (p in h)
  printf fmt, p, h[p], u[p]
}
!_[$1,$2]++ { u[$1]++ }
{ h[$1]++ }' file
That's neat and terse! Exactly the way I like it! I should have thought to use a regex as FS.
Reply With Quote