Linux search for word and show entire line

grep, linux

Solution

grep --after-context=5 --before-context=10 'Nov 12 2012' yourfile.log

That'll show each line that contains your date text, as well as 10 lines of text BEFORE the line that matched, and 5 lines AFTER the line that matched.

Problem

I have a very large log file (6 gig). I want to search for '`Nov 12 2012`' and print off each line. I'm a linux novice and have no idea how this is done. Mostly likely will need a more option to view X number of lines and move forward thru the search.

Original source