I ve a file like following
input file:
NopTX(5) // should be remain same as input
----Nop(@100); //1
Nop(90); //2
--Nop(80); //3 @Nop(70); //4
--@Nop(60); //5 @Nop@(@50); //6
--Nop@( 40); //7
Nop(@-30); //8
@ represents tab space and
represents a single space
I want to change the file as follows
output
NopTX(5) // should be remain same as input
----Nop(@500); //1
Nop(450); //2
--Nop(400); //3 @Nop(350); //4
--@Nop(300); //5 @Nop@(@250); //6
--Nop@( 200); //7
Nop(@-150); //8
Basically the number inside the "()"is changed to five times than the input file.
I ve written a programme as follows but then I m facing problem with "how to replace that variable temp in the input file
#!/bin/sh
for ttt in `find . -name "*.file" -print `
do
awk '
/^[ \t]Nop[ \t]\(/{
split($0, a, /\(|\)/)
temp = a[2]*5
But one problem I only want to change the variables that is starting with the variable "Nop"
In the above the first line also affected . but that should not be in my case.. The value changes from 5 to 25 in the above case ..
I ve modified my programme it is doing the same what I want ,
gawk '
/[1]Nop[ \t]\(/{
split($0, a, /\(|\)/);
tem = a[2]*5;
print a[1] "(" tem ")" a[3] >> "./my_tmp";
next
}
{ print $0 > "/tmp/my_tmp" } ' $ttt
mv my_tmp $ttt
but I was impressed with your code and I want to learn that superb online code ,
Sorry for your anticipation