WYAE - FWTOOLS Mailing List Archive
| RE: [fwtools] Suggestion - Null Values in Templates
|
| From: | "WISNIEWSKI, DANIEL (SBCSI)" |
| Date: | Thu, 7 Oct 2004 14:27:43 -0400
|
Hi -
Thanks for responding....
=20
Yes, I had thought about doing that as another processing script, as I
renumber rule numbers from 1 -> 9 to 001-> 009.
remove / add/ change other stuff. so maybe I'll just grab each
position and if its' empty - change it=20
=20
as for the comments try this out:
=20
copy your rulebases_5_0.fws into someplace you can "play: with it.
=20
Now if grep for comments ( Where all the rule comments are) I have ,
as an example
:comments ("rx1489#566389, rx1649#795276")
:comments ("rl2435#795641")
:comments ()
:comments (562424)
:comments (562428)
:comments ()
:comments ()
:comments ()
:comments ("jy2967#551747")
=20
If you notice, there are no quotes (") for 562424. so , edit a
comment ( or add a comment) and add it just as a number. - better yet -
make a comment in one of your rulebases and just add numbers ( no other
characters ) -=20
and the script won't pick it up. I'm trying to track it
down.
=20
Thanks again for the advice - i'll give it a try.
=20
dan
=20
=20
=20
=20
=20
-----Original Message-----
From: Reto Schuettel [mailto:reto-fwtools@schuettel.ch]=20
Sent: Thursday, October 07, 2004 1:48 PM
To: fwtools@wyae.de
Cc: WISNIEWSKI, DANIEL (SBCSI)
Subject: Re: [fwtools] Suggestion - Null Values in Templates
=09
=09
Hi Dan=20
You wrote:=20
> ITEM 1=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
> =20
> I use Templates to Load into MySQL=20
Hm, you could use the templates for creating sql code directly
:)?=20
> Accordingly, at times I need to find fields that have "null" (
empty)=20
> values. =20
> =20
> Perhaps a change in code=20
> =20
> around line 3267=20
>=20
> ## For DB Nulls=20
> if ( $access_comment[$i] ) {=20
> $line =3D~ s/<<>>/$access_comment[$i]/g;=20
> } else {=20
> $line =3D~ s/<<>>/NULL/g;=20
> fi=20
> }=20
Hm, in my opinion this solution is quiet ugly, because it breaks
everything :). You have to implement that as an optional
parameter, like=20
--print-nulls or something like that, you should never change
the default=20
behavior!=20
As an temporary workaround (until somebody implement this
features - who=20
volunteers? :)) you could use a postprocess script, which
replaces the=20
'empty' values with a NULL.=20
If you use tabs as delimiter:=20
# fwtool.pl ...=20
# perl -i -pe 's/\t\t/\tNULL\t/g' output.tsv # these both
commands=20
# perl -i -pe 's/\t\n/\tNULL\n/g' output.tsv # replaces all the
empty=20
# strings with NULL
# (untested)=20
# mysql 'LOAD INTO FILE .. bla bla output.tsv'=20
> ITEM 2 =3D=3D=3D=3D=3D=3D=3D=3D=20
> =20
> COMMENTS that are entered with just a numerical value - DO NOT
SHOW UP=20
> when used with templates. It appears CP add's a "quote" to any
> "character string" - but not a numerical value:=20
> =20
> Therefore IF you add a comment such as a tracking number ie:
2766 =20
> It will not show up in your template output.=20
> However, IF you added a comment such as : #2766 it will show
up.=20
Hm, atm I don't have an fw rulebase with such comments, but if I
have=20
time I'll try to verify that tomorrow. Empty comments are
exported=20
correctly:=20
(i used vim with ':set list' output, with this options all the
tabs are represended with '^I')=20
9^I160.59.191.192/27^I194.69.181.57^Itcp22^ISSH admin access for
NCC / ENG.$=20
5^I192.168.190.126^I192.168.190.126^Itcp18191, tcp256,
udp6372^I$=20
as you can see, the rule nr 5 has an 'emtpy' field.=20
- reto=20
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---