Solved

How to write a nant open file and replace string script

Posted on 2008-10-13
3
4,554 Views
Last Modified: 2013-11-10
After attempting many different methods I would appreciate input.  Why does the following not work.  It does not appear to be touching the file at all.

<copy file="${makedir}\make.i" tofile="${makedir}\make.i.bak"/>                                                    
<loadfile file="${makedir}\make.i" " property="${makedir}\make.i.bak">
      <filterchain>
              <replacestring from="#old" to="new"/>
                     </filterchain>
<copy file="${makedir}\make.i.bak"  tofile="${makedir}\make.i"/>
<loadfile file="${makedir}\make.i.bak" property="${makedir}\make.i">
    </loadfile>

0
Comment
Question by:roverplant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:tdiops
ID: 22742724
Try sed instead:

sed 's/old/new/g' $mkdir/make.i >  $mkdir/make.i.bak && mv $mkdir/make.i.bak $mkdir/make.i
0
 

Accepted Solution

by:
roverplant earned 0 total points
ID: 22836795
Solution:
<move file="${makedir}\make.i" tofile="${makedir}\make.i.bak"/>      
copy file="${makedir}\make.i.bak" tofile="${makedir}\make.i">                                                    
      <filterchain>
              <replacestring from="#old" to="new"/>
      </filterchain>
</copy>
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question