The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-04-2008
jaduks's Avatar
jaduks jaduks is offline
Registered User
  
 

Join Date: Aug 2007
Location: Assam,India
Posts: 167

Code:
$ cat file.txt
AA
BB
CC
DD
EE
FF
GG
HH
II
$ sed -n '/^DD/{p;n;p;n;p;n;p;n;p;}' file.txt
DD
EE
FF
GG
HH

or 

If you don't want the pattern,
$ sed -n '/^DD/{n;p;n;p;n;p;n;p;n;p;}' file.txt

//Jadu