Thread: awk script help
View Single Post
Old 05-09-2008, 09:24 PM   #2 (permalink)
lensman3
Registered User
 
Join Date: Oct 2007
Location: Littleton, Colorado USA
Posts: 412
OS: xp 64 sp2 Fedora Core 8 (vmware xp core 8 x32) Minix


Re: awk script help

It will be in the form of:

awk '/.html/ {HTML=HTML+1}
/.htm/ {HTM=HTM+1}
/.doc/ {DOC=DOC+1}
END {
printf("HTML=%s; HTM=%s; DOC=%s\n", HTML, HTM, DOC);}'


It might be better to use perl. Perl has a lot of libraries that know about correct syntax html files. The libraries can parse the document and return various pieces of it.

The code snipit above came from a shell script call "dvddup.sh". Go and google for it. It has a lot of awk in it. Also go to the directory "/usr/bin" and "grep awk *". There are a lot of files distributed with my Fedora Core 8 that have awk scripts in them.

Hope this helps.
lensman3 is offline   Reply With Quote