EDITED
I am looking out for a command to use both GREP and FIND to achieve the below-listed condition.
Every log file contains the string pattern "226 transfer complete" which occurs twice. In some files, it occurs only once or nil. I need to capture the list of file names with zero and one occurrence. Following command works ONLY if the search pattern not found in the file (i.e for count 'ZERO' only).
find . -type f -name "*.log" ! -exec grep -q "226 Transfer complete." {} \; - print
I am using the grep version (GNU grep) 2.20. I need to capture the results in the text file as well.