Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] rrd to CSV
Date: Sat, 11 Jul 2009 14:57:41
Message-Id: 200907111557.36833.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] [OT] rrd to CSV by Willie Wong
1 On Monday 06 July 2009, Willie Wong wrote:
2 > On Sun, Jul 05, 2009 at 11:07:23PM +0100, Penguin Lover Mick squawked:
3 > > > from Cacti forums):
4 > > > | grep -v NaN | grep '<row>' | tr e ' ' \
5 > > > | awk {'print "Q"$2"qcq"$3"qcq"$9"Q"'} \
6 > > > | tr Q '"' | tr c ',' | tr q '"'"
7 > > >
8 > > > Haven't tested it, but looks like it should work.
9 > >
10 > > Hmm, I don't think it gets anywhere:
11 > > =======================================
12 > > cat test.xml | grep -v NaN | grep '<row>' | tr e ' ' | awk
13 > > {'print "Q"$2"qcq"$3"qcq"$9"Q"'} | tr Q '"' | tr c ',' | tr q '"'" >
14 > > test.csv
15 > >
16 > > =======================================
17 > >
18 > > It just sits there at the > cursor. I think it needs something more to
19 > > it, or
20 >
21 > Looks like a syntax error with improperly nested quotations marks.
22 >
23 > The last command in the sequence, which reads
24 >
25 > tr q '"'"
26 >
27 > try replacing that with
28 >
29 > tr q '"'
30 >
31 > (remove the final double quote)
32 >
33 > W
34
35 Thank you both! It works to a point. This is what the xml file contains:
36
37 <database>
38 <!-- 2009-07-02 07:41:00 EDT / 1246534860 --> <row><v>
39 7.3395000000e+01 </v><v> 4.7990000000e+01 </v></row>
40
41 The CSV file only shows the first value and then it does not pick up the fact
42 that it is exponential:
43
44 "2009-07-02","07:41:00","7.3395000000"
45
46 How could it be tweaked to a)account for e+01, b)include additional value
47 fields?
48
49 Thanks again.
50 --
51 Regards,
52 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] [OT] rrd to CSV Willie Wong <wwong@××××××××××××××.edu>