Thanks that was a great starting point! OK, I've made a start,
but I need help:
I created the following simple functions (which could be put in init.m, for example)
nbScan[line_, str_] := If[StringMatchQ[line, ___ ~~ str ~~ ___], Print@line]
onefile[fn_, str_] := (Print["searching for \"", str, "\" in ", fn];
Map[nbScan[#, str] &, StringSplit[Import[fn, "Plaintext"], "\n"]];)
nbs[str_] := (files = FileNames[StringJoin[NotebookDirectory[], "*.nb"]];
Map[onefile[#, str] &, files];)
Now I can search all notebooks in the current directory by typing something like this in a cell":
nbs["Plot"]
Here is sample output:
searching for "Plot" in C:\Users\Gilrays\Documents\Mathematica\Play1.nb
ListPlot[Map[Total, Map[Last, FactorInteger[Range[2, 1000]], {2}]]]
Manipulate[ListPlot[Total/@Map[Last, FactorInteger[Range[2, x]], {2}]], {x, 2, 1000}]
searching for "Plot" in C:\Users\Gilrays\Documents\Mathematica\tips.nb
...
Some things I'd like help with:
1) How do I get rid of the extra empty line after each "match"
2) I'd like to bold each match like this:
List
Plot[Map[Total, Map[Last, FactorInteger[Range[2, 1000]], {2}]]]
3) other ideas?
Thanks in advance,
-Joe