filter input & outputs to another file

Hello All,

I am stuck with the follwing problem , pls give me some advice..

Input file:

  input clock;
  input reset; \\reset all
  input [9:0] yuv;

  //input comment
  output sur;
  output sud;
  output [1:0] vtua;
  output [8:0] tur;
  input   [4:0] ebi;
  //output comment

The input file has some input & output pins. And the statement can start with one or more spaces OR one or more tabs.

Output file:

\\Inputs
clock 
reset
yuv[9:0]
ebi[4:0]
\\Outputs
sur
sud
vtua[1:0]
tur[8:0]

I tried with the followin but not yet suceded.

gawk '\
  {
  gsub(/(^ *|^\t)/, "", $0) \\ for cutting one or more space OR tab
  if( match($0,/^input/) ){
          print $0 > "del1"
  }
  if( match($0,/^output/) ){
          print $0 > "del2"
  }
}' file

Regards,
prady

If the problem is not clear pls let me know..

Thanks in advance.

Regards,
prady