frequency of word

Go down

frequency of word

Post  Admin on Fri Aug 15, 2008 2:21 am

you have to write a script to count the frequency of a particular word in given file? Question

Admin
Admin

Posts : 39
Join date : 2008-08-03

View user profile http://computerclub09mnnit.forumotion.net

Back to top Go down

Re: frequency of word

Post  Beagle on Sat Aug 16, 2008 5:32 am

awk 'BEGIN{search_string = <whatever>}
{for(i=1;i<=NF;i++)
if($i == search_string)
count++;
}
END {print count}' <file>

Beagle

Posts : 9
Join date : 2008-08-11

View user profile

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum