How to replace all carriage returns with Ant

I am trying to replace all carriage return ( "\x0D") occurrences using the simple ant task, all the *.shfiles in the test directory. This doesn't seem to be a trick.

This is my script; Am I doing something wrong? (The global flag gdoesn't seem to help either)

<?xml version='1.0'?>
<project name="myproject" default="cr_remover" basedir=".">
  <target name="cr_remover">
    <replaceregexp match="\x0D" replace="" flags="g" byline="true">
      <fileset dir="."><include name="**/*.sh"/></fileset> 
    </replaceregexp>
  </target>
</project>
+3
source share
2 answers

This will work:

<replaceregexp match="\x0D" replace="" flags="sg">

May I ask why you are not using FixCRLF Task ?

<fixcrlf srcdir="." includes="**/*.sh"
  eol="lf"
  eof="remove"
/>
+6
source

On the apac man page replaceregexp

<replaceregexp match="\s+" replace=" " flags="g" byline="true">
    <fileset dir="${html.dir}" includes="**/*.html"/>
</replaceregexp>

Please note that you have

 <fileset dir="."><include name="**/*.sh"/></fileset>

I am missing the person ant to find out if this is causing your problem.

Hope this helps.

  • , .
  • Q & A, , enter image description here, , . , , , enter image description here
0

All Articles