How to select several lines before search line in Linux?

Sometimes you need to look for something (i.e. grep) in file, but you want to see several lines BEFORE and AFTER the line you're looking for. So, how can you do this in Linux?

grep -B 3 -A 3 "Deploying" catalina.out

It looks for text "Deploying" in file catalina.out and returns 3 lines before (-B switch) and after (-A switch) the line with text "Deploying".


I always used to read article in news papers but now as I am a user of internet
so from now I am using net for articles, thanks to web.

If some one desires expert view concerning running a blog afterward i suggest him/her to visit this weblog, Keep up the good job.

Today, I went to the beach with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She placed the shell to her ear and
screamed. There was a hermit crab inside and it pinched
her ear. She never wants to go back! LoL I know this is totally off topic but I had to
tell someone!

Ahaa, its fastidious discussion regarding this paragraph at this place at this website, I have read all that, so
now me also commenting here.

I think this is one of the so much significant information for me.
And i'm glad reading your article. However want to remark on few general issues, The web site style is perfect,
the articles is truly excellent : D. Good task, cheers

Yesterday, while I was at work, my cousin stole my apple ipad and
tested to see if it can survive a 40 foot drop, just so
she can be a youtube sensation. My iPad is now broken and she has 83 views.
I know this is totally off topic but I had
to share it with someone!

If you would like to improve your familiarity just keep visiting this website
and be updated with the hottest news posted here.

Greate post. Keep writing such kind of info
on your blog. Im really impressed by your blog.

Hi there, You've done a fantastic job. I will certainly digg it and personally recommend to my
friends. I am confident they will be benefited from
this website.

I need to to thank you for this excellent read!!
I definitely enjoyed every bit of it. I have you saved as a favorite to look at
new stuff you post…

What's up i am kavin, its my first occasion to commenting anyplace, when i
read this article i thought i could also make comment due to this good piece of writing.

There's definately a great deal to find out about this issue.
I really like all of the points you made.