Query: Rule Based Command Line Response Parser



Hi

I am looking for some open source Rule Based Command Line Response
Parser.
By rule based i mean i wish to provide an input file (which will
contain parsing rules for a particular command).

Example: For command 'route' following is response.

[anuj@anuj ~]$ /sbin/route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref
Use Iface
172.31.44.0 * 255.255.255.0 U 0
0 0 eth0
169.254.0.0 * 255.255.0.0 U 0
0 0 eth0
default 172.31.44.1 0.0.0.0 UG 0
0 0 eth0


Now suppose i want to save above data in a HashMap/Table (rowwise or
column wise). So for that i may create an input file which will have
rules in say XML
1) Fields are in order "Destination", "Gateway" etc
2) There may be some empty lines which needs to be skipped eg. Skip
first 3 lines.
3) Look out for a particular string and then retrieve the value which
follows the string.
Eg. cpuid level : 2
Here i may look for "cpuid level" and then store its value "2" in a
field in HashTable.


I was looking for a rule based parser as i feel it will avoid normal
hardcoding that most of parsers have. Since it works according to
rules specified it can be used for parsing of response of any type of
CLI devices.
Do let me know anyone has idea related to it.

Thanks,
Anuj
.



Relevant Pages

  • you toss mild rains in addition to the hon disastrous laboratory, whilst Saeed again injures them to
    ... guarantee Ramsi's yacht in response to outlets, ... command the guilt. ... Hardly any female foods counter ... Mohammar precisely confines a clinical folly next to Eliza's ...
    (sci.crypt)
  • [PATCH] Cleanups for the IPMI driver
    ... off the shutdown of the timer when removing the module. ... static int ipmi_init_msghandler; ... * Send a command request from the given user. ... * the message response comes back, the receive handler for this user ...
    (Linux-Kernel)
  • RE: POP3 delivers Multiple messages only from outside emails
    ... Thanks again for the response. ... I did everything you said with the telnet. ... When I did a LIST command it came back with this ... > This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.windows.server.sbs)
  • Re: GSM GPRS using Dial Up
    ... i am getting the AT+ERROR as response. ... issuing the same command. ... Actually there is some problem with GSM power up ... function "BSPUartConfigTranceiver" for COM3). ...
    (microsoft.public.windowsce.embedded)
  • Re: GSM GPRS using Dial Up
    ... i am getting the AT+ERROR as response. ... issuing the same command. ... Actually there is some problem with GSM power up ... function "BSPUartConfigTranceiver" for COM3). ...
    (microsoft.public.windowsce.embedded)