Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to search a particular string inside a folder structure.

The File system contains multiple files, but i need to check only XML files.

I searched and tried the commands for Linux Recursive search but it did not work. I got the following output from the command

$ grep -rio --include=*.xml "invokeAction" .
grep: No match.
$ grep -riwc "invokeAction" *
grep: <.Lists all the file Names recursively.>: No such file or directory
$ grep -ir invokeAction *.xml
grep: <.Lists all the file Names.>: No such file or directory

Please help.

I need to search

String: "invokeAction"
Mode: Word Only
Directory: Current Directory Recursively 
share|improve this question
add comment

1 Answer

This will search from path, recursively, for all python files (*.py) and run grep -l import on each file

find /path/To/Seach -iname \*.py -exec grep -l import {} \;

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.