Learn how to use find to identify filenames matching specified patterns. We'll use find to identify all .jsx files in a directory, or all test files in a directory.
find . -name "*jsx" // find filename with jsx in current folder find examples/ -name "*Spec.js" // find filename with spec.js in examples folder
Learn to use the xargs Unix command to combine find and grep. First we can use find to identify which files we want to search; then we can use xargs to tell grep which files to search through.
find examples -name "*spce.js"
After we get all the filename then we want to seach for "describe" for each file:
find examples -name "*spce.js" | xargs grep describe
It is the same as:
grep -r --include="*spec.js" "describe" examples/