grep directory containing mysqlbinlog files for files

I want to check all the files in a directory full of mysqlbinlog files for text of 'incident' and get -A10 lines after.

for example i can check 1 file at a time with:

mysqlbinlog /var/lib/mysql/mysqld-relay-bin.005794 | grep incident -A10
Who is Participating?
Maciej SConnect With a Mentor sysadminCommented:
mysqlbinlog /var/lib/mysql/mysqld-relay-bin.* | grep -A10 incident
mcgilljdAuthor Commented:
and to put results in a file is it?

mysqlbinlog /var/lib/mysql/mysqld-relay-bin.* | grep -A10 incident > outfile.txt
Maciej SsysadminCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.