?
Solved

How to write a nant open file and replace string script

Posted on 2008-10-13
3
Medium Priority
?
4,656 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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

719 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