need a logic for awk programming

Hello Friends,

I have a txt file like below

//*Init Start
Reg(read,12'h42E,16'h0000);
Nop(5628.5);
//*Init End

//*Main Start
Reg(read,12'h42E,16'h0000);
Nop(5628.5);
//*Main End

I want to calculate the values between //* Init Start & //* Init End
And //*Main Start & //*Main End.
But in a single awk programme I need to process separately for Init Block and Main Block.

Means when it founds Init start it should be in a loop until it founds Init End and when it founds Main start it should be in a loop until it founds Main End .

Please need help .. Thank you in advance..

what's the code you have?

gawk '
 
BEGIN{
}
/\/\/\*Main Start/ {
       while( $0 !~ "\/\/\*Main End"){
       print "Inside Main " $0
       next
       }
  }
/\/\/\*Init Start/ {
       while( $0 ~! "...Init End"){
       print "Inside Init " $0
       next
       }
  }
' myfile

but it shows me error when I use gawk
gawk: cmd. line:10: warning: escape sequence `\/' treated as plain `/'
gawk: cmd. line:10: warning: escape sequence `\' treated as plain `'

and in nawk no output..

I want to do something like this

/\/\/\*Init Start/ {
       print "Inside Init " $0
       while(getline ){
               if ($0 !~ /\/\/\*Init End/){
                       print $0
               }
       }
  }

But not working what exactly I want..
I want to print all those lines Inside Init Start And Init End and nothing else

to display text between 2 patterns,

awk '
/Init Start/ , /Init End/  {
    print $0
}' "file"

do the same for "main"

Yes now I am getting what I want

/\/\/\*Init Start/ {
       print "Inside Init " $0
               while ($0 !~ /\/\/\*Init End/){
                       getline;
                       print $0
               }
  }

You can try like this :

Instead of writng to file, you can put the logic you want.

awk '/Init Start/,/Init End/{print $0>"init_file"} /Main Start/,/Main End/{print $0>"main_file";}' filename

Output: