I would like to know if there is any way to scan a text file and then run a command. I have tried grep getting nowhere. I have also tried the find . thing, it sounds promising but I can’t seem to get a good explanation on how to use it. If you would like to know what this will be used for here is an explanation: I have an iPhone app that sends a word over http, the server side application is listening for the command and when received it runs a command.
Share
The following will cat all files that find finds that contain “needle” and will show their contents. Modify accordingly:
find . -exec grep needle -q {} \; -exec cat {} \;