need help guys for Regular expression in awk

Hello Experts,

Please help me to cope with the following problem

I ve patterens like

Input
Noptx(5) // remain the same
-*Nop(3);
Nop(9);
--Nop(8); // remain the same d3
**---Nop(7); //remain the same d3
**---Nop(7);
*--Nop(6);
--**Nop(5);
-Nop(4);
Nop(3);

  • represents a space
  • represents a tab space
    Desired OUPUT

Noptx(5) // remain the same
-*Nop(6);
Nop(18);
--Nop(8); // remain the same d3
**---Nop(7); //remain the same d3
**---Nop(14);
*--Nop(12);
--**Nop(10);
-Nop(8);
Nop(6);

I want to change the no to two times but which matches the below patteren

CASE-1: Zero or more spaces/tabs then Nop AND
CASE-2: The line should not end with d3 .

Basically if both patteren matches then double the no inbetween ()
Previously I ve a suggestion but that wont work for the first statement in my input file

awk -F '\\([@- ]|\\)' 'NF==3{sub($2,$25)};1' file1

Now my code only does the CASE-1 but how to overcome both I ve no idea .

gawk '
/^[ \t]*Nop\(/{
split($0, a, /\(|\)/);
print a[1] "(" a[2]*2 ")" a[3] "// d3" >> "/tmp/my_tmp";
next
}
{ print $0 > "/tmp/my_tmp" } ' file

pls help.......
Regards
User_Prady

Try....

awk -F '\\([-@ ]*|\\)' '!/(Noptx|d3$)/&&NF==3{sub($2,$2*2)};1' file1

Output...

Noptx(5) // remain the same
-*Nop(6);
Nop(18);
--Nop(8); // remain the same d3
**---Nop(7); //remain the same d3
**---Nop(14);
*--Nop(12);
--**Nop(10);
-Nop(8);
Nop(6);

Edit: In your original post you gave a sample file where you said

So you would need to change the "@-" in the above code.

Yes you are absolutely correct my friend.

I tried with the following code

gawk '

   /d3$/\{ print $0 >> "/tmp/my_tmp"; next \}

    /^[ \\t]*Nop[ \\t]*\\\(/\{
              split\($0, a, /\\\(|\\\)/\);
                  temp = a[2]*19.2
                  print a[1] "\(" temp "\)" a[3] "   //d3 Nop\("a[2]"\) \\n" >> "/tmp/my_tmp";
	      next
\}
\{ print $0 > "/tmp/my_tmp" \} ' $file 

Again Thanks a lot to the site and to brilliant people here..