I need get all the texts in the matching file in the folder , however at the same time need to get the matching file path as well . Can you please advise , how can I get the matching file path as well using below command
find . -type f -name release.txt | xargs cat
CodePudding user response:
try
find . -type f -name release.txt -exec grep -il {} \; | xargs cat
CodePudding user response:
Skip xargs, just do:
find . -type f -name release.txt -exec sh -c 'echo "$1"; cat "$1"' _ {} \;