in reply to Count word in my dir

I am having a bit of trouble understanding what exactly you are trying to accomplish... but I'll try to help you anyway.

How many times does the word "FOO" show up in a file name?

There is are more ways to do this than you can shake a stick at (why you would go around shaking sticks at things I have no idea..) but I will propose a couple here.

Shell method

Perl method

How many times does the word "FOO" show up in a file in my directory?

Ahh... here is a better problem, one with a pair of fine solutions!

Shell Method

Perl Method

A couple of things I should point out:

Hope this helps.


Peter @ Berghold . Net

Sieze the cow! Bite the day!

Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.

Brewer of Belgian style Ales