in reply to Count word in my dir

Works fine for me (once I added a shebang). You could also get this with cmd-line tools:

ls -l | grep -i WORDHERE | wc -l

Or, you could combine the readdir with a grep in perl:

@files = grep /WORDHERE/,readdir(DIR);



-beernuts

Replies are listed 'Best First'.
Re: Re: Count word in my dir
by Cine (Friar) on Aug 01, 2003 at 00:46 UTC
    This wont work, if the word appears two times in a single line...
    A more robust solution would be
    grep -h -i WORDHERE * | perl -le 'while(<>){$i+=s/\bWORDHERE\b//ig} pr +int $i'


    T I M T O W T D I