Home · Latest · Trends  /  general
0

Grep command to display line containing the variable along with lines before and after options

rated 0 times [  0] [ 0]  / comments: 0 / hits: 174  / 11 months ago, wed, feb 21, 2018, 15:16:03
Grep command to display line containing the variable along with lines before and after options - Example: I have a file containing numbers 1 - 9 each in newline. I am trying grep for value 5 and want to display 5, 3 entries after and 2 entries before the occurance of 5
cat gp | grep -A 3 -B 2 5
3
4
5
6
7
8
More From » general
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Sponsor
Posted
vishymac

vishymac

Member since Feb 23, 2017
Total Code Snippets: 6
Total Comments: 0
Location: Philadelphia
Following
User not following anyone yet.
vishymac snippets
1 year ago, fri, jul 21, 2017
1 year ago, fri, jul 21, 2017
11 months ago, mon, feb 19, 2018
2 months ago, mon, oct 29, 2018