ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nat Gross <natgross.rentalsyst...@verizon.net>
Subject Re: Cleaning a text file with tons of extra CRLF's
Date Thu, 13 Jan 2005 03:59:06 GMT
Ok. Releasing ver 1.0RC <g>. (Using your reminder on "&#013".)
Also capitalizing on the fact that its an xml target that needs the 
messaging, I can safely replace every single CRLF with ....null, "", 
nada. Then replace every "/>" with "/>LF". Its real simple and works, 
and achieves 99.9% of my goal. Here it is.
********
<project name="replaceDupeLF" default="default" basedir=".">
    <target name="default">
        <replace file="${basedir}/build370.xml"  token="&#013;&#010;" 
value="" summary="true"></replace>
        <replace file="${basedir}/build370.xml"  token="/&gt;" 
value="/&gt;&#010;" summary="true"></replace>
    </target>
</project>
********
Thank you;
-nat


Julius Davies wrote:

>Hi, Nat,
>
>I never would have thought of that!  Really neat!
>
>Actually, "&#013;" is a CR, not 015.
>
>yours,
>
>Julius
>
>On Wed, 2005-01-12 at 21:25 -0500, Nat Gross wrote:
>  
>
>>Thanks, but for whatever reason, I can't get  replacetoken to work, 
>>regardless if using CDATA or plain strings.
>>BUT, you pointed me in the right direction and the following *partially* 
>>works:
>> <replace file="${basedir}/build370.xml"  token="&#010;&#010;" 
>>value="&#010;" summary="true">
>>
>>However, it's only a partial solution, because it takes care of only 
>>about half the white space, and heaven knows what the other white space 
>>really is. Alas there is no valid &#015; escape sequence. (That would 
>>represent a CR).
>>
>>Also to Martin, alas, I'm not well versed in regex.
>>-nat
>>
>>
>>Julius Davies wrote:
>>
>>    
>>
>>>Try this:
>>>
>>><replace file="test.txt" value="">
>>> <replacetoken><![CDATA[
>>>
>>>]]></replacetoken>
>>> <replacevalue><![CDATA[
>>>]]></replacevalue>
>>></replace>
>>>
>>>Be careful to make sure the CDATA only contains the EOL's and no extra
>>>whitespace!
>>>
>>>BEFORE:
>>>=======================
>>>this file
>>>
>>>seems to be
>>>
>>>double spaced
>>>
>>>except for the
>>>very last line.
>>>
>>>
>>>AFTER:
>>>=======================
>>>this file
>>>seems to be
>>>double spaced
>>>except for the
>>>very last line.
>>>
>>>
>>>yours,
>>>
>>>Julius
>>>
>>>On Wed, 2005-12-01 at 19:34 -0500, Nat Gross wrote:
>>> 
>>>
>>>      
>>>
>>>>Hi;
>>>>On Windows, I get a daily text file from another process that has tons 
>>>>of extra EOL's, which I manually delete with my editor.
>>>>How can I use Ant's filter to copy the file and strip all duplicate 
>>>>eol's? The fixeol task does not cut it. It should have an option to 
>>>>remove the eol, or replace every 2 consecutive eol's with 1.
>>>>If its a quick one for you, please advise.
>>>>Thank you.
>>>>-nat
>>>>
>>>>        
>>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message