On Mon, 2014-08-18 at 18:54 +1000, Adam Carter wrote:
> But this matches if grep fails both times as well as when it matches both
> time. Any ideas?

If you don't mind using a quick loop, you could use something like:

n=0
for f in file1.txt file2.txt file3.txt file4.txt; do
    grep 'string' ${f} >> /dev/null && n=$[n+1]
done

if [[ $n == 4 ]]; then
    do_something
fi


-- 
wraeth <wra...@wraeth.id.au>

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to