in reply to Reading a Directory of Files, Searching for Text, Outputting Matches
It seems you are searching for a combination of find, xargs, grep and simple output redirection. No perl needed:
find /some/where/in/the/wild -name '*.txt' -print0 | xargs -0 grep -A3 + 'needle_in_the_haystack' > result.txt
Alexander
|
|---|