Re: recursively count the words occurrence in the text files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/30/2010 11:34 AM, S Mathias wrote:
> mkdir one
> mkdir two
> mkdir three
>
> echo "word1 word2 word3">  one/asf.txt
> echo "word2 word4, word5">  one/asfcxv saf.txt
> echo "word1. word2">  one/dsgsdg.txt
>
> echo "word6, word3!">  two/sdgsd dsf.txt
> echo "word6">  two/ergd.txt
>
> echo "asdf, word2">  three/werdf.txt
> echo "word7, word8 word9 word10">  three/qwerb erfsdgdsg.txt
> echo "word4 word3">  three/web erg as.txt
>

Simplest would be:

grep -r -c word one two three

which produces:

one/asfcxv:1
one/asf.txt:1
one/dsgsdg.txt:1
two/ergd.txt:1
three/web:1
three/werdf.txt:1
three/qwerb:1

There are other options that will give you more precision, but basically 
I think that grep will give you what you want.

(If I understodd the question ... )
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux