I have a text file like this:

> 
> ...  
> 
>  NAME : *name-1*  
> 
>  ...  
> 
>  NAME : *name-2*  
> 
>  ...  
> 
>  ...  
> 
>  ...  
> 
>  NAME : *name-n*  
> 
>  ...
> 
> 
> 

I want output text files like this:

> 
> name\_1.txt : NAME : *name-1* ...  
> 
>  name\_2.txt : NAME : *name-2* ...  
> 
>  ...  
> 
>  name\_n.txt : NAME : *name-n* ...
> 
> 
> 

I have the basic knowledge of grep, sed, awk, shell scripting, python.