Grep start and end line of each segments in a file

Cat file1

--------
----------
SCHEMA.TABLE1
insert-------
update-----
-------------
----------
SCHEMA.TABLE2
insert-------
update-----
-----------
------------
SCHEMA.TABLE3
insert-------
update-----
------------

grep -n SCHEMA > header_file2.txt

1: SCHEMA.TABLE1  
25:SCHEMA.TABLE2 
30:SCHEMA.TABLE3 

I need to print values of each schema content to temp file.

sed -n '1,24p' file1.txt > file.tmp$$

sed -n '25,29p' file1.txt > file.tmp$$

Question is how can I get the start and ending line in the header file.so h that I can use with sed to place each table contents into file.

1: SCHEMA.TABLE1  (1-24)
25:SCHEMA.TABLE2  (25-29)
30:SCHEMA.TABLE3  (30-end)

I have below idea but its kind of making it complex. (syntax may not correct)

1:1:SCHEMA.TABLE1  
2:25:SCHEMA.TABLE2
3:30:SCHEMA.TABLE3

start=1
start1=expr `$start+1`

end=expr `head -$start1 file1 |tail-1 |cut-d':' -f2`-1  (24) 

sed '1, $end' > tmp

start=2
start1=expr `$start+1`

end=expr`head -3 $start1 |tail-1 |cut-d':' -f2`-1  (29)

sed '1, $end' > tmp

Regards,
Veera

Any other way we can do it without using awk?

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.