Shell – How to get surrounding lines of grep result?

Problem:
I'm using grep to search for an error and want to display the surrounding lines also as they contain related information. How to do that?

Solution:
Using grep -C <# of lines to show above and below> <search> <file>

The following prints the matched line, along with the 5 lines surrounding it.

$ grep -C 5 "search" sample_text

Also we can use grep -A or -B to display number of lines above or below the matched line.

The following prints the matched line, along with the 5 lines after it.

$ grep -A 5 "search" sample_text

The following prints the matched line, along with the 5 lines before it.

$ grep -B 5 "search" sample_text

Reference:

Posted in Tech Notes | Tagged | 1 Comment

Happy Easter

Happy Easter
Easter celebrates the resurrection of Jesus Christ. It is the most important feast in the Christian calendar.I wish you “Happy Easter”.

Posted in Off Topic | Comments Off

(Another) First day at WaveNET

Today is my second “First day at WaveNET”, yes it is, because I had another First day at WaveNET sometime back during my industrial training in 2007.

Nothing much has changed here since then, or somethings have. So the day started as just another normal day, but didn’t have anything much to do till lunch, except for a meeting with HR and HPM. I was assigned to the ——— team.
.
.
.
.
.
Feeling bored…. So end of post… :-)

Posted in Random Thoughts | 3 Comments

Smart Card (2005) – A Sci-Fi Short

Smart Card (2005) - A Sci-Fi Short
Ramanan pointed me to a short film Smart Card, produced and directed by James Oxford, is a science fiction film about the horrors of living with modern technology, where every transaction is done through one system, Smart Card.

Part 1:

Smart Card (2005) – Part 1 on YouTube

Part 2:

Smart Card (2005) – Part 2 on YouTube

I found this one interesting as I have been in a project for sometime where we are dealing with some smart card stuff. Smart Card is a smart film that will make you laugh, think, and then start to worry about the dangers of letting technology get the best of you. This well executed storyline has won many awards from various film festivals for Best Short Film, details here.

Thought I feel it is too dramatic to think this would happen in near future, I think we are little too much addicted to technology and there might be day when we start to go behind technology.

The full film can be downloaded from the Oxford Entertainment website, where you can get many more details about “Smart Card“. You can also download Smart Card directly from here.

Posted in Media | Tagged | Comments Off

Why the YouTube logo changed to Green?

I was just creeping through YouTube, just to find something interesting to watch,what got my attention was the changed YouTube logo.
Just a little Google search revealed that this green logo is to celebrate the Saint Patrick’s Day.

Saint Patrick’s Day is celebrated worldwide by the those of Irish descent and increasingly by non-Irish people (usually in New Zealand, Australia, and North America). Celebrations are generally themed around all things Irish and, by association, the colour green. - Wikipedia

YouTube goes green for Saint Patrick’s Day…! So I am with making this post in green font… :-)



Happy Saint Patrick’s Day to all…!

Posted in Tech News | Tagged , | Comments Off