On Monday 06 July 2009, Willie Wong wrote:
> On Sun, Jul 05, 2009 at 11:07:23PM +0100, Penguin Lover Mick squawked:
> > > from Cacti forums):
> > > | grep -v NaN | grep '<row>' | tr e ' ' \
> > > | awk {'print "Q"$2"qcq"$3"qcq"$9"Q"'} \
> > > | tr Q '"' | tr c ',' | tr q '"'"
> > >
> > > Haven't tested it, but looks like it should work.
> >
> > Hmm, I don't think it gets anywhere:
> > =======================================
> > cat test.xml | grep -v NaN | grep '<row>' | tr e ' ' | awk
> > {'print "Q"$2"qcq"$3"qcq"$9"Q"'} | tr Q '"' | tr c ',' | tr q '"'" >
> > test.csv
> >
> > =======================================
> >
> > It just sits there at the > cursor.  I think it needs something more to
> > it, or
>
> Looks like a syntax error with improperly nested quotations marks.
>
> The last command in the sequence, which reads
>
>   tr q '"'"
>
> try replacing that with
>
>   tr q '"'
>
> (remove the final double quote)
>
> W

Thank you both!  It works to a point.  This is what the xml file contains:

 <database>
                        <!-- 2009-07-02 07:41:00 EDT / 1246534860 --> <row><v> 
7.3395000000e+01 </v><v> 4.7990000000e+01 </v></row>

The CSV file only shows the first value and then it does not pick up the fact 
that it is exponential:

"2009-07-02","07:41:00","7.3395000000"

How could it be tweaked to a)account for e+01, b)include additional value 
fields?

Thanks again.
-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to