How to extract a text portion from a file

Can some one help me with shell script to extract a text block between two known strings.

The given input file is as below:

Name: abs
Some tesxt....
Some tesxt....
Some tesxt....
end of text
Name: xyz
Some tesxt....
Some tesxt....
Some tesxt....
end of text
Name: efg
Some tesxt....
Some tesxt....
Some tesxt....
end of text

output file should contain

Name: xyz
Some tesxt....
Some tesxt....
Some tesxt....
end of text

Example with sed:

sed '/Name: xyz/,/end of text/!d' infile

Example with awk:

awk '/Name: xyz/,/end of text/ {print}' infile

Check for "addressing" or "ranges" if you want to read up about it.

try:

sed '/Name: xyz/,/end of text/!d' filename

If you are looking for the entire name searches in the file try

sed '/Name: /,/end of text/!d' <filename>

Hi Thanks

awk '/Name: xyz/,/end of text/ {print}' infile

is working fine!!

One more small request..

If the pattern of the input file is

line1..
line2..
Name: abs
Some tesxt....
Some tesxt....
Some tesxt....
end of text
line1..
line2..
Name: xyz
Some tesxt....
Some tesxt....
Some tesxt....
end of text
line1..
line2..
Name: efg
Some tesxt....
Some tesxt....
Some tesxt....
end of text

how to get the output file as

line1..
line2..

Name: xyz
Some tesxt....
Some tesxt....
Some tesxt....
end of text

using awk

hi , if your file is in fixed format that each section contains 5 lines, simply use below should be ok

sed -n '/xyz/{N;N;N;N;p;}' yourfile

otherise, may try below awk

awk '{
if($0 ~ /xyz/)
	flag=1
if(flag==1)
	print
if($0 ~ /end of text/)
	flag=0
}' yourfile