I am processing a huge file. I want to search for a word in the line and when found I should print 10 lines before and 10 lines after the pattern match. How can I do it in P
Use grep with -C option, easiest solution:
grep
-C
grep -C 10 'what_to_search' file.txt