The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




Thread: grep problem
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-21-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,272
Not grep, but an example with sed:
Code:
root@isau02:/data/tmp/testfeld> cat infile
ID .... VALUE
A001 .... 100
B002 .... 200
A004 .... 300
B006 .... 100
A997 .... 200
B776 .... 400
root@isau02:/data/tmp/testfeld> sed -n '/B002/ {p;n;p;n;p}' infile
B002 .... 200
A004 .... 300
B006 .... 100
Please use [ c o d e ] and [ / c o d e ] tags when displaying code or output from logs/errors etc., ty