how to parse output of application?

Chad Perrin perrin at apotheon.com
Wed Aug 4 00:29:02 UTC 2010


On Tue, Aug 03, 2010 at 12:58:34PM -0700, Chip Camden wrote:
> > 
> > I not that great in programming so writing a ruby or shell script do do this would take me weeks:-(
> 
> 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.

-- 
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20100804/9a864054/attachment.pgp


More information about the freebsd-questions mailing list