This question already has an answer here:
- grep surrounding characters of a match 2 answers
I have a compressed JS code and I want to find a pattern, but since the file is compresses, it has only a line, and the match pattern is all the file. The output is too much large.
grep -r "myPattern"
I can do:
grep -r --only-matching "myPattern"
but in this way, I get just the matching characters, and I need more information.
Ideally, I'd want the matching characters and a number defined of characters before and after those matching characters.