--- Erik Hatcher <[EMAIL PROTECTED]> wrote:

> Um.... nevermind..... I missed the part that there
> is "just a blank 
> line".  A custom FilterReader would work - have it
> only affect the 4th 
> line.
> 
>       Erik

All you have to match is the line break count, so
assuming you know what those are (use fixcrlf worst
case)  tokenfilter + filetokenizer + replaceregex
works.  My self-contained example (with Jakarta ORO as
my regexp engine):

<project>
  <property name="br" value="${line.separator}" />
  <property name="insert" value="hello world" />

  <echo file="foo.txt" append="false">01
bla${br}</echo>
  <echo file="foo.txt" append="true">02
bla${br}</echo>
  <echo file="foo.txt" append="true">03
bla${br}</echo>
  <echo file="foo.txt" append="true">04 ${br}</echo>
  <echo file="foo.txt" append="true">05 ${br}</echo>
  <echo file="foo.txt" append="true">06 ${br}</echo>
  <echo file="foo.txt" append="true">07
bla${br}</echo>
  <echo file="foo.txt" append="true">08
bla${br}</echo>
  <echo file="foo.txt" append="true">09
bla${br}</echo>

  <copy file="foo.txt" tofile="bar.txt">
    <filterchain>
      <tokenfilter>
        <filetokenizer />
        <replaceregex
pattern="^(.*${br}.*${br}.*${br}.*)(${br}.*)"
                      replace="\1${insert}\2" />
      </tokenfilter>
    </filterchain>
  </copy>
</project>

-Matt


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to