[SWLUG] locating bits of code in large number of files

Neil Jones linlist2 at nwjones.demon.co.uk
Fri Oct 15 22:14:36 UTC 2004


I am sure this is a very very simple question but I cant think how to answer 
it. Maybe I have been too long at the keyboard today.

It is quite simple to describe. On my large website I have thousands of static 
pages. I am now getting to the point where I am converting the whole thing to 
a dynamic system. I am using URL rewiriting to make this transparent.

Now In the process of doing this I am looking for certain pages that have a 
piece of javascript code on them. I know it is on some and I know it is not 
on others but I am not sure which they are.

I can search a single directory with the command

cat *.html | grep getS 

My question is simple. Given that I have one root directory with dozens of 
subdirectoriess below it. ( They only go one deep - there are no directories 
within directories) How do I make a single command list the examples from all 
the files.

All I really need is a count of the number of files with and without the code 
as I am actually looking for what will change under the new system. I can 
work this out from a count of those with. Listing a line for every example is 
good enough for me to do this.


One complication my hosting , which was chosen 5 years ago before I learned 
about the wonders of Linux, is on FreeBSD.

TIA 

Neil

 
--
Neil Jones- Neil at nwjones.demon.co.uk http://www.butterflyguy.com/
"At some point I had to stand up and be counted. Who speaks for the
butterflies?" Andrew Lees - The quotation on his memorial at Crymlyn Bog 
National Nature Reserve.




More information about the Swlug mailing list