On Fri, 20 Nov 2009, John P. Rouillard wrote:

> Hi David:
>
> In message <alpine.deb.2.00.0911192139410.10...@asgard.lang.hm>,
> david at lang.hm writes:
>> I am creating rules that accumulate log lines into a context for a later
>> report.
>>
>> since these are _long_ log lines, they will wrap in the e-mail client when
>> I send them. I would like to add an extra newline when I add text to the
>> context, but I cannot figure out how to make this work.
>
> Maybe use sub-pattern matches to break the line into multiple pieces and add
> each piece?
>
>  pattern=^(.*some matching thing)(.{60})(.*)
>  action = add context $1; add context $2; add context $3

this could work, but having to do a second rule and action just to add a 
newline is a very expensive way to do things.

> I think that will add three lines.
>
> Use eval to create a perl function that will format its argument by
> inserting newlines.  Then in your action calling it on $0 "call
> %{result} %{eval_fnction_handle} $0; add context %{result}".

I'm not sure how to do this.

> When you report the context you could pipe it through fmt or some
> other formatting program (but that may not be better than the wrapping
> in the email client).

yes, but I hate to have to re-write all my output routines to parse the 
input from sec to reformat it. in this case it's a simple 'add a blank 
line between every line' reformatting, but I can definantly see future 
options that would be messier.

> If you just need a newline after each line you add, assign a variable to
> newline and add it:
>
>  assign %N \n; add context %N;
>
> I am not sure if \n works for setting a newline though.

no, this inserts the characters \n not a newline.

David Lang

> Let us know which of these ideas work.
> --
>                               -- rouilj
> John Rouillard
> ===========================================================================
> My employers don't acknowledge my existence much less my opinions.
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Simple-evcorr-users mailing list
> Simple-evcorr-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to