Archive | December 2013

Extract lines between Pattern using sed and awk


One Liners to extract lines :  

1) To extract lines including Pattern : 

sed -n ‘/Pattern_Start/ , /Pattern_End/p ‘ Filename

2) To extract lines excluding Pattern : 

awk ‘/Pattern_Start/ { p=1; next } /Pattern_End/ {exit} p’ Filename

Advertisements
%d bloggers like this: