![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need explanation | Mari.kb | UNIX and Linux Applications | 1 | 11-23-2007 10:41 AM |
| tr explanation please | convenientstore | Shell Programming and Scripting | 1 | 05-30-2007 11:42 PM |
| tr explanation please | convenientstore | Shell Programming and Scripting | 0 | 05-30-2007 11:12 PM |
| Need explanation for the syntax(code) | chandhar | Shell Programming and Scripting | 1 | 03-21-2007 04:59 AM |
| AWK explanation | penfold | Shell Programming and Scripting | 2 | 04-05-2005 09:46 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
AWK deifnition and some small code explanation
Could someone give me a quick simple explanation for the AWK command.
And also help me to explain the code i have made. I have made some general comments about it myself. I was wondering if people could help me with the rest: Code:
awk -F'[: ]' 'END {
fmt = "%-20s\t%s\t%s\n" # Formats the table output
printf fmt, "Page:", "Hits:", "Unique Hits:" # Defines Column Headers
for (p in h)
printf fmt, p, h[p], u[p]
}
!_[$1,$2]++ { u[$1]++ } # u[x] counts the number of occurrences of x in field column 1.
{ h[$1]++ }' HITS | # h[x] counts the number of occurrences of x in field column 1.
( IFS='' read header; echo "$header"; sort -k2rn ) # discard any duplicates where same combination of column 1 and 2 has been seen before
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|