I'm not very experienced in shell scripting, but I'm trying to understand how to grep for a pattern and for each file where there is a match write a file to disk that contains the matched line from grep. For example:
$ grep -E "MY PATTERN" myfile{1,3}
Then write out new files that contain the matching lines:
matches-myfile1
matches-myfile2
matches-myfile3
Is this possible? How can I do this? I'm looking for an answer is bash or zsh.