Posted: Thu May 15, 2008 1:10 pm Post subject: dynamic editing using shell script
Hi,
I would like to edit an input data-file by changing a variable in it
in steps:
For ex: If my input file is 'big.in', then it has the following data:
2.54 0.01 0.5 0.0
My source code then reads this above line, executes and gives out some
output. Then ,
I want to increment the value "0.01" in the above file by some step
and the source code reads it again, executes and gives another output
and so on...
I can use Finding & replacing (ex: 's/0.01/0.02/g') to replace a
previous value, but if there are 100 values I need to substitute, it
becomes cumbersome..there must be a better way, like using a variable
for finding and replacing...
I would like to edit an input data-file by changing a variable in it
in steps:
For ex: If my input file is 'big.in', then it has the following data:
2.54 0.01 0.5 0.0
My source code then reads this above line, executes and gives out some
output. Then ,
I want to increment the value "0.01" in the above file by some step
and the source code reads it again, executes and gives another output
and so on...
I can use Finding & replacing (ex: 's/0.01/0.02/g') to replace a
previous value, but if there are 100 values I need to substitute, it
becomes cumbersome..there must be a better way, like using a variable
for finding and replacing...
I would like to edit an input data-file by changing a variable in it
in steps:
For ex: If my input file is 'big.in', then it has the following data:
2.54 0.01 0.5 0.0
My source code then reads this above line, executes and gives out some
output. Then ,
I want to increment the value "0.01" in the above file by some step
and the source code reads it again, executes and gives another output
and so on...
I can use Finding & replacing (ex: 's/0.01/0.02/g') to replace a
previous value, but if there are 100 values I need to substitute, it
becomes cumbersome..there must be a better way, like using a variable
for finding and replacing...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum