Menu

#4 .conf to BEGIN/END "a la awk"

closed
None
5
2004-07-13
2004-07-01
No

Hi!

I've just installed Jacson 0.89 and like to write a .conf
file to substitute an "awk" program that does the
following:

1. adds a header to each file (in the BEGIN rule)
2. adds a footer to each file (in the END rule)
3. according to some rules, modifies the matching lines
(can also add lines)

How can I do this with Jacson?

I'm trying with:

<application>
<jacson>
<filter se:this="PadFilter">
<pre>aaa </pre>
<post>bbb</post>
</filter>
<eval se:this="LoggingEvaluator"/>
<report se:this="ValuePrintingReport">
<section>lines/log/chunk</section>
</report>
</jacson>
</application>

but it is adding "aaa" and "bbb" to the beginning and
ending of each LINE respectively, not to the beginning
and ending of each FILE.

Thanks in advance.

Best Regards,
Jose M Beas

Discussion

  • Patrick Carl

    Patrick Carl - 2004-07-05
    • assigned_to: nobody --> pcs_org
     
  • Patrick Carl

    Patrick Carl - 2004-07-05

    Logged In: YES
    user_id=613247

    Hello Jose,

    thanks for using Jacson.
    With the current release, we did not found a solution for your problem.
    Attached
    you'll find a new version of jacson.jar. Please update your existing installati
    on and try something like:

    <application>
    <jacson>
    <filter se:this="HeadPadFilter" ownchunk="false">
    <pre>This is the start</pre>
    </filter>
    <filter se:this="TailPadFilter" ownchunk="true">
    <post>:This is the end</post>
    </filter>
    <eval se:this="LoggingEvaluator"/>
    <report se:this="ValuePrintingReport">
    <section>lines/log/chunk</section>
    </report>
    </jacson>
    </application>

    The Filters used are new. Via the parameter ownchunk you can determine
    whether o
    r not the text to append or prepend should be used as own chunk or if it
    should
    be connected to the last or first chunk.

    Have a try and please give feedback if it works for you!

    Patrick

     
  • Patrick Carl

    Patrick Carl - 2004-07-05

    Jacson-Jar containing Head- and TailPadFilter

     
  • Patrick Carl

    Patrick Carl - 2004-07-13
    • status: open --> closed
     
  • Patrick Carl

    Patrick Carl - 2004-07-13

    Logged In: YES
    user_id=613247

    Issue closed
    The new Filters will be part of the next jacson release.

     
  • José M Beas

    José M Beas - 2004-07-13

    Logged In: YES
    user_id=561641

    Dear Patrick,

    First of all, excuse me for the delay in my answer.

    I've just tried your hint with the attached .jar and it worked
    fine.

    Just one issue: how can I introduce a '\n' after my "<pre>"?

    It's more, how can I introduce any '\n' either in the head or
    tail text?

    Thanks a lot,
    Jose M Beas

     
  • José M Beas

    José M Beas - 2004-07-13

    Logged In: YES
    user_id=561641

    Hi, again!

    Sorry, I'll answer myself.

    <filter se:this="HeadPadFilter" ownchunk="true">

    instead of ownchunk="false".

    The same works for the TailPadFilter, in your example it was
    ownchunk="true" and it worked for me.

    Thanks again,
    Jose M Beas

     
  • Patrick Carl

    Patrick Carl - 2005-10-03

    Logged In: YES
    user_id=613247

    HeadPad- and TailPadFilter are included in the new release
    Jacson 0.90. Please note that the parameter name has changed
    from ownchunk to separatechunk.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.