Rebhan, Gilbert wrote:

Hi,

scenario = a txtfile where i have to put a value in.

The line where that value should go is always line number 26 of
that file. line number 26 is always blank and should contain the
value after transformation.

I've tried with :

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


<copy file="${txtfile}" tofile="modified.txt"> <filterchain> <tokenfilter> <filetokenizer /> <replaceregex pattern="(.*${br}{25})(${br}.*)" replace="\1${insert}\2" /> </tokenfilter> </filterchain> </copy>

The script runs, but the file stays the same.
Must be a logical error in the regex syntax.

(.*${br}{25})(\s${br})

group 1 = any sign, one or more, followed by linebreak, 25x (= 25 lines)
group 2 = the next (blank) line

replace \2 = replace group 2 with ${insert}

Where do i go wrong ? Don't know exactly how to write the replace part.
My regexengine is the java builtin (1.4.2_05)

Thanks for any hint !

Gilbert



Why not use concat with a filterchain/headfilter?
Basically you read (with headfilter lines=25) the first 25 lines, concat the 26th line, then again using the headfilter this time skipping the blank line. The point is that concat can append any text string, not only the contents of files.
my $0.02
-nat


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



Reply via email to