Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Aug 2010 18:26:43 -0600
From:      Chad Perrin <perrin@apotheon.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: how to parse output of application?
Message-ID:  <20100804002643.GA25435@guilt.hydra>
In-Reply-To: <20100803195834.GA2753@libertas.local.camdensoftware.com>
References:  <988913.74048.qm@web51104.mail.re2.yahoo.com> <20100803195834.GA2753@libertas.local.camdensoftware.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 03, 2010 at 12:58:34PM -0700, Chip Camden wrote:
> >=20
> > I not that great in programming so writing a ruby or shell script do do=
 this would take me weeks:-(
>=20
> Well, I'd use Ruby.  Read the whole file into a string and find the
> relevant bits with Regexp.

I'd say either Perl or Ruby is the way to go in this case, because of
regular expression support and the nifty functions/methods you can use
with them (e.g. Perl's map and Ruby's collect), depending on which of
them best suits your way of thinking.  Using shell scripts would, I
think, be a bit more of an arcane exercise for someone relatively new to
coding, given the assumption that you're going to use regexen as the
workhorse.

Another nice tool for this sort of thing, in both languages, is the split
function/method.

Unfortunately, nothing comes immediately to mind that wouldn't involve
writing some code -- so if it would take you weeks to write code to do
the work for you, I guess you're stuck with taking weeks to do it, unless
you want to just do it all by hand.

--=20
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

--WIyZ46R2i8wDzkSu
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAkxYs8MACgkQ9mn/Pj01uKXPxwCfeD45IJVEoBS45khT5CzkqDq3
qZUAoJ/zc0d/ldSPgnTfLNeynBRSMAd9
=01Hd
-----END PGP SIGNATURE-----

--WIyZ46R2i8wDzkSu--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100804002643.GA25435>