From owner-freebsd-questions@FreeBSD.ORG Tue Aug 3 19:58:40 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF7A0106566B for ; Tue, 3 Aug 2010 19:58:39 +0000 (UTC) (envelope-from sterling@camdensoftware.com) Received: from wh2.interactivevillages.com (wh2.interactivevillages.com [75.125.250.34]) by mx1.freebsd.org (Postfix) with ESMTP id A6FCF8FC08 for ; Tue, 3 Aug 2010 19:58:39 +0000 (UTC) Received: from 174-21-99-21.tukw.qwest.net ([174.21.99.21] helo=_HOSTNAME_) by wh2.interactivevillages.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1OgNQM-0002NR-LJ for freebsd-questions@freebsd.org; Tue, 03 Aug 2010 12:45:19 -0700 Received: by _HOSTNAME_ (sSMTP sendmail emulation); Tue, 03 Aug 2010 12:58:34 -0700 Date: Tue, 3 Aug 2010 12:58:34 -0700 From: Chip Camden To: freebsd-questions@freebsd.org Message-ID: <20100803195834.GA2753@libertas.local.camdensoftware.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <988913.74048.qm@web51104.mail.re2.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline In-Reply-To: <988913.74048.qm@web51104.mail.re2.yahoo.com> User-Agent: Mutt/1.4.2.3i Company: Camden Software Consulting URL: http://camdensoftware.com X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - wh2.interactivevillages.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - camdensoftware.com Subject: Re: how to parse output of application? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 19:58:40 -0000 --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable >=20 > Can you help me with this task I have? I have a lot of files in a subdire= ctory containing the following text: >=20 > Correctly Classified Instances=A0=A0=A0=A0 3018117=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 56.6808 % > Incorrectly Classified Instances=A0=A0 2306643=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 43.3192 % > Kappa statistic=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 0.2443 > Mean absolute error=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 0.4304 > Root mean squared > error=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 0.4586 > Relative absolute error=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 124.= 1251 % > Root relative squared error=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 110.1308 % > Total Number of Instances=A0=A0=A0=A0=A0=A0=A0=A0=A0 5324760=A0=A0=A0=A0= =20 >=20 >=20 > =3D=3D=3D Detailed Accuracy By Class =3D=3D=3D >=20 > TP Rate=A0=A0 FP Rate=A0=A0 Precision=A0=A0 Recall=A0 F-Measure=A0=A0 ROC= Area=A0 Class > =A0 0.618=A0=A0=A0=A0 0.343=A0=A0=A0=A0=A0 0.681=A0=A0=A0=A0 0.618=A0=A0= =A0=A0 0.648=A0=A0=A0=A0=A0 0.697=A0=A0=A0 1 > =A0 0.519=A0=A0=A0=A0 0.244=A0=A0=A0=A0=A0 0.617=A0=A0=A0=A0 > 0.519=A0=A0=A0=A0 0.564=A0=A0=A0=A0=A0 0.693=A0=A0=A0 2 > =A0 0.296=A0=A0=A0=A0 0.141=A0=A0=A0=A0=A0 0.056=A0=A0=A0=A0 0.296=A0=A0= =A0=A0 0.094=A0=A0=A0=A0=A0 0.66=A0=A0=A0=A0 3 >=20 >=20 > =3D=3D=3D Confusion Matrix =3D=3D=3D >=20 > =A0=A0=A0=A0=A0=A0 a=A0=A0=A0=A0=A0=A0 b=A0=A0=A0=A0=A0=A0 c=A0=A0 <-- cl= assified as > =A01784321=A0 684983=A0 416649 |=A0=A0=A0=A0=A0=A0 a =3D 1 > =A0 787342 1190428=A0 314537 |=A0=A0=A0=A0=A0=A0 b =3D 2 > =A0=A0 49255=A0=A0 53877=A0=A0 43368 |=A0=A0=A0=A0=A0=A0 c =3D 3 >=20 > I need to parse this file to get in a csv file the following information: >=20 > Correctly Classified Instances, Kappa statistic, Total Number of Instance= s, Precision {1}, Recall {1}, F-Measure > {1},Precision {2}, Recall {2}, F-Measure {2},Precision {3}, Recall {3}, = F-Measure {3},a,b,c,a,b,c,a,b,c > 56.6808, > 0.2443, 5324760, 0.681,0.618,0.648,0.617,0.519,0.564,=20 > 0.056,0.296,0.094,1784321,684983,416649,787342,1190428,314537,49255,53877= ,43368 >=20 > Does anyone have an idea how this could be accomplished? >=20 > I not that great in programming so writing a ruby or shell script do do t= his would take me weeks:-( >=20 > Thanks > Dino >=20 >=20 >=20 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" Well, I'd use Ruby. Read the whole file into a string and find the relevant bits with Regexp. --=20 Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F http://camdensoftware.com | http://chipstips.com | http://chipsquips= .com --OXfL5xGRrasGEqWY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iQEcBAEBAgAGBQJMWHTqAAoJEIpckszW26+RzeQH/ilZYsG3YJGvPWSH9gxQHyhg OaOTobWDe4LM4vXas7EU1j3oXXPjFTReGTA0Y/mFpVSrkfUty8xIH8+MBl1vFjpK QsMHiXAdiRvwE/eNy0R+8WKxpYPDEQ0x8UIG+nxoA9GxsMikiSL+VsbRSdQUhWzi m7v1TnnECLRcqb+iWe8JXPE7ARF1PUbavxpNqhnrZ0Yr/koxHk4cp3f32+n8IaXl 3ohzpQ81DetUOAe8BgyT6szGn+44l8Vml1AALUHOkHhhdKCQjDvhwUfXjUL5w4Ws NwZMS6ceM7Dk30C78AqG1erl20SBtgXGOqL/E0TdGmJaFW5vmf2nfa3Z42Jb9mU= =TMu0 -----END PGP SIGNATURE----- --OXfL5xGRrasGEqWY--