HI All,
I want to cut 5 lines after a pattern using sed or awk. can any one tell me how to do it ?
HI All,
I want to cut 5 lines after a pattern using sed or awk. can any one tell me how to do it ?
$ 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
awk '/pattern/{n=5;next}n{print;n--}' file
Regards