I have the problem that I get too much information after the match for
grep -RnisI --color=auto "pseudomonas" *
I want to get only like 20 characters or 10 words after and before the match.
What is the right tool to do such a thing?
This should do it for you
If you don't want to cat, you can just use the grep with the file as a parameter:
Hope it helps
Also, The -P uses Perl Regex, which the man pages says is experimental, if you want to avoid that flag, you could just use egrep instead:
Assumes matches and their context don't overlap and that filenames don't contain
Also note that the reported line numbers are those of the beginning of the context.