Search Sketches?

I have a ton of sketches using various libraries and test code - is there a way to search them? For example, I tried out a new library a few years ago and want to revisit it now that it's been updated with some needed code changes. How do I find my sketches which used that library?

find . -name "*.ino" | xargs grep - l "<your library name here>"

Hi,
I think that this software you help you find "text" inside files.

DocFetcher

Search in google othes using args..
"How find txt insoide files".

RV mineirin

Example for Windows command line:

findstr /s /i /p "Adafruit_LEDBackpack" *.ino

I use a Windows program called Agent Ransack. The free Lite version.
https://www.mythicsoft.com/agentransack/information/#features

Thanks, but does anyone know if there is there a Mac app I can use?

Use the MacOs Terminal utility. It gives you a command line unix environment which should not be intimidating… and may become essential if you do much of this kind of play or work.

This

works well, I add a few things

find . -iname "*.ino" | xargs grep -l -i -s  "<your library name here>"

which removes a space that I think breaks the command line, and makes it case not sensitive. And supresses a bunch of grep errors.

Where would we be without grep, diff and xcargs?

a7

Thank you! I have used Terminal before but am not fluent in unix commands or regular expressions. However, I was able to find the sketches using "jled.h" so .... success!

EDIT: it doesn't seem to find all occurrences. Here's the output:

Rosss-NEW-MacBook-Pro:Arduino Projects rwaddell$ find . -iname "*.ino" | xargs grep -l -i -s "#include <jled.h>"
./libraries/JLed/examples/multiled/multiled.ino
./libraries/JLed/examples/candle/candle.ino
./libraries/JLed/examples/fade_off/fade_off.ino
./libraries/JLed/examples/user_func/user_func.ino
./libraries/JLed/examples/fade_on/fade_on.ino
./libraries/JLed/examples/breathe/breathe.ino
./libraries/JLed/examples/simple_on/simple_on.ino
./libraries/JLed/examples/hello/hello.ino
./libraries/JLed/examples/morse/morse.ino
./libraries/JLed/examples/sequence/sequence.ino
./sketch_nov15a/sketch_nov15a.ino
./sketch_dec20a/sketch_dec20a.ino
./AStar_32u4_Serial_Monitor_Test/AStar_32u4_Serial_Monitor_Test.ino
Rosss-NEW-MacBook-Pro:Arduino Projects rwaddell$ 

But it doesn't find:

./test/prototypes/All_Blinkies_v1/All_Blinkies_v1.ino

I did a Windows Mobile short course about ten years ago; all the development was on Windows 7, and the course was conducted by Murkysoft developers.
It amazed me that Murkysoft themselves didn't have a decent directory search, and advised us to install voidtools' Everything for desktop directory searches.

(I'm almost equally amazed that Apple doesn't have such a tool)

I've been defaulting to VS Code lately for GUI-based text searches. It probably wouldn't make sense to use it for that purpose alone, but I am using it constantly as an editor already so it is the tool I have at hand. It is cross platform so I don't need to worry about remembering which tool to use on which OS as I hop from one to the other.

I use NetBeans for web development and it has an excellent search feature, so maybe I’ll try that. The only downside is you need to create a project which loads the source code into the application (same goes for Brackets).

In Finder, open your sketchbook.
Click on the search icon (magnifying glass) at the top right of the window.
Type in the name of the library include file.

I use AstroGrep, but it's only for PCs.

Doesn't the Finder itself do a pretty good job?

Actually, it does. At first I thought it didn’t find all .ino files but after trying a few other approaches it seems like it did.

Yeah, usually it works. :expressionless:

It may help to put a smaller search string on the grep arguments list. You’ll get many more hits, perhaps, but you won’t miss something that might have had a slight difference like a space instead of a tab &c.

a7