frequency of word

Post new topic   Reply to topic

View previous topic View next topic Go down

frequency of word

Post  Admin on Fri Aug 15, 2008 8: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 11: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-12

View user profile

Back to top Go down

View previous topic View next topic Back to top


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