Computing.Net > Forums > Unix > Awk scripting help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Awk scripting help

Reply to Message Icon

Name: xmikex
Date: February 27, 2007 at 18:09:56 Pacific
OS: solaris
CPU/Ram: unknown
Product: unkown
Comment:

I am having some serious issues with my program
I think for the most part it works, but it isn't deleting duplicate lines...
ANy assistance would be greatly appreciated, or if I am going about
everything wrong, some other guidance would be helpful as well.

Here is my program
#!/bin/sh
#Created by Michael Scarpa
#Project 2
#this following section allows for the various commands to happen, it
takes in $
#and it removes the html, strips out back to and chapter, puts each word
on its$
BEGIN {RS=" "}

{

#makes it all lowercase
$0 = tolower($0)
#removes punctuation
gsub (/[,;:!\?\.\(\)]/,"", $0)
#removes back
gsub (/back/,"",$0)
#removes page
gsub (/page/,"",$0)
#removes numbers
gsub (/[0-9]/,"",$0)
#removes blank space
sub (/^[ \t]+/, "")
}

#this section should only print non duplicates
{
if (data[$0]++ ==0)
lines[++count]=$0
}
END {
for (i=1;i<=count;i++)
print lines[i]
}



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Awk scripting help

awk script help www.computing.net/answers/unix/awk-script-help/5596.html

tweaking William's awk script www.computing.net/answers/unix/tweaking-williams-awk-script/5174.html

awk call other awk script? www.computing.net/answers/unix/awk-call-other-awk-script/5574.html