Computer Club MNNIT
Would you like to react to this message? Create an account in a few clicks or log in to continue.

frequency of word

2 posters

Go down

frequency of word Empty frequency of word

Post  Admin 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

https://computerclub09mnnit.forumotion.net

Back to top Go down

frequency of word Empty Re: frequency of word

Post  Beagle 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

Back to top Go down

Back to top


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