If you use OS pipes, you will appreciate filterchains. -----Original Message----- From: Nat Gross [mailto:[EMAIL PROTECTED] Sent: Thursday, January 13, 2005 4:41 PM To: Ant Users List Subject: Re: Cleaning a text file with tons of extra CRLF's
filterchains? I will need to catch up on that topic. Thanks for the tip. -nat Matt Benson wrote: >Also, have you tried using filterchains? You can use >the ignoreblank filter to remove blank lines. And it >might look a little prettier. > >-Matt > >--- Nat Gross <[EMAIL PROTECTED]> >wrote: > > > >>Ok. Releasing ver 1.0RC <g>. (Using your reminder on >>" >> >> >".) > > >>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=" >> >> >" > > >>value="" summary="true"></replace> >> <replace file="${basedir}/build370.xml" >>token="/>" >>value="/> >> >> >" summary="true"></replace> > > >> </target> >></project> >>******** >>Thank you; >>-nat >> >> >>Julius Davies wrote: >> >> >> >>>Hi, Nat, >>> >>>I never would have thought of that! Really neat! >>> >>>Actually, " >>> >>> >" 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=" >> >> > >" > > >>>>value=" >>>> >>>> >" 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 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]