The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-14-2008
habzone2007 habzone2007 is offline
Registered User
 

Join Date: May 2008
Posts: 6
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...

Any help would be appreciated

Thanks
Reply With Quote
Forum Sponsor