For Programmers: Free Programming Magazines  


Home > Archive > AWK > May 2004 > Re: Display the line number containing a word which is consecutively duplicated,and d









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Display the line number containing a word which is consecutively duplicated,and d
Cityhunters

2004-05-12, 7:19 pm

Hi everyone,

I try again and end's up with this solution.although it wasn't 100%
perfect ,but at least it fulfill the basic requirement.

awk -f cgw.AWK inputfile > outputfile
BEGIN { counter = 0 }
/WORD/ { for (i=1; (i <= NF); i+=1)
{ if ($i == "WORD") counter += 1 }}
END { print (" NFR"," WORD occurs ") }

Any suggestion?
^_^
thank you!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com