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

Tags:

About Vaibhav

Friendly & Co-operative.

One response to “Extract lines between Pattern using sed and awk”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: