[SWLUG] locating bits of code in large number of files
Paul G. Richardson
phantompgr at btopenworld.com
Sat Oct 16 10:43:14 UTC 2004
Neil,
grep -r is a recursive search so something like grep -r getS *.html will
list all those html files from the current dir and subdirectories that
match. If too long pipe through more.
PGR
Neil Jones wrote:
> 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.
>
> _______________________________________________
> SWLUG Discussion List - Discuss at swlug.org.uk
> http://list.swlug.org.uk/mailman/listinfo/discuss
More information about the Swlug
mailing list