I'm trying to find a way to
grep -o "somepattern"
which gives me something like
html/file.js
2:somepattern
5:somepattern
but what would be really nice is to have a few characters (maybe 20) before and/or after that match.
I know there is a way to show lines before and after (context), but is there any way to show context by characters? e.g.
html/file.js
2:function helloWorld(somepattern) {
5: var foo = somepattern;
The reason I ask is that if I grep recursively and hit a minified file with a match, it prints the entire file, which is super annoying.