Showing posts with label print next 7 lines after pattern match using sed. Show all posts
Showing posts with label print next 7 lines after pattern match using sed. Show all posts

Saturday, January 23, 2010

Print next 7 lines of the file sample2 after pattern match from file sample1:



for i in `cat sample1`;do sed -n "/$i/{p;n;p;n;p;n;p;n;p;n;p;n;p;n;G;p;}" sample2 ; done