I have to parse a lot of UNIX CLI output, most of the time, the output is a table, but they always differ in number of columns/format...etc, I have to keep modifying my parsing code for every command. TxtFSM makes life easy but i still have to write the template.
I would like to write a script that will automatically detect the CLI output and when it detects a table, it would parse it. As a newbie to the world of Parsing, I wonder How hard/complicated could that be ? If anyone have seen similar efforts/projects before ?
I always get confused with advanced parsing topics like BNF, YACC...etc
Thanks
Here is how you can parse
df
output into table using perl and Marpa::R2script (
~
denotes lexical rules):output: