My SQL query looks like this...
sekect * FROM mail_headers a LEFT JOIN mail_headers_body b ON a.mailid=b.id blah blah blah
I can select the lines before and after the result, using -A, -B switches. But how do I find the 4 words before and after the selected text?
grep -i 'JOIN mail_headers_body' mysql-gen.log
This will return the query mentioned above. But what I want to know is 4 "words" before the selected text. i.e.
FROM mail_headers a LEFT
And 4 (or 5) words after...
b ON a.mailid=b.id blah