# OT: "show run" parser

**URL:** <https://www.ruby-forum.com/t/ot-show-run-parser/172043>\
**Category:** Ruby\
**Created:** [July 13, 2009, 7:34pm UTC](https://www.ruby-forum.com/t/ot-show-run-parser/172043 "2009-07-13T19:34:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoshbad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e274bd/32.png) [@hoshbad](https://www.ruby-forum.com/u/hoshbad)\
**Post date:** [July 13, 2009, 7:34pm UTC](https://www.ruby-forum.com/t/ot-show-run-parser/172043/1 "2009-07-13T19:34:19Z")

</div>

Dear Rubyists,  
I realize this is a fairly off-topic question, but I’m wondering if any  
of you know of a tool that can read the output of “show run” (like in a  
Cisco switch), parse the output, and produce a nice-looking document.

Anything perchance written in Ruby?

Thanks much!

---

<div class="post-metadata">

**Author:** ![hoshbad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e274bd/32.png) [@hoshbad](https://www.ruby-forum.com/u/hoshbad)\
**Post date:** [July 14, 2009, 5:20am UTC](https://www.ruby-forum.com/t/ot-show-run-parser/172043/2 "2009-07-14T05:20:51Z")

</div>

Hi,

Am Dienstag, 14. Jul 2009, 02:34:26 +0900 schrieb Sebastian W.:

> I realize this is a fairly off-topic question, but I’m wondering if any  
> of you know of a tool that can read the output of “show run” (like in a  
> Cisco switch), parse the output, and produce a nice-looking document.

I don’t know the “show run” command and what you want to parse out  
of it. I guess the information you like to retrieve is not that  
complicated.

`show run`.grep /^col1/

Bertram

---

<div class="post-metadata">

**Author:** ![hoshbad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e274bd/32.png) [@hoshbad](https://www.ruby-forum.com/u/hoshbad)\
**Post date:** [July 14, 2009, 12:35pm UTC](https://www.ruby-forum.com/t/ot-show-run-parser/172043/3 "2009-07-14T12:35:33Z")

</div>

“Sebastian W.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> Dear Rubyists,  
> I realize this is a fairly off-topic question, but I’m wondering if any  
> of you know of a tool that can read the output of “show run” (like in a  
> Cisco switch), parse the output, and produce a nice-looking document.

> Anything perchance written in Ruby?

It’s difficult to have a generic tool for Cisco configs considering the  
vast  
number of options there can be and the somewhat idiosyncratic format  
they each  
come in!

You may find something here: [http://cosi-nms.sourceforge.net/](http://cosi-nms.sourceforge.net/)

Unlikely to be any in Ruby though.

I have seen the occassional conversion s/w on the web but I have no  
references.

It depends a lot on what you mean by “nice looking document” of course.  
Presumably you want to extract only certain portions for display.  
I wrote a reasonably generic parser in Python some time ago, it  
basically  
looked for indented sections and common prefixes and specifically  
checked for  
the sort of thing we have on our routers. I could try and dig it out if  
you’re interested (email me). I also started an extendable parser in  
Ruby but  
it’s far from done and it was the first non-trivial Ruby program I wrote  
so  
it’s probably very bad Ruby style (it’s probably also way over the top  
since  
it was for analysing the contents of Pix configs).

Eddie
