Paragraph parser is used to extract the essential data in recurring lines of text and place it into a tabular shape.

Applicable Parser Rules for Paragraph Parser

Single-line Rule

Start/End Line

Text Replacement

When to Use a Paragraph Parser

Paragraph parser can be used to convert variables across multiple sections of the raw text into a table data structure, so diagnosis against each row can be exacted.

Three Steps to Define a Paragraph Parser

To define a paragraph variable, you need three steps:

1.Define one or more ID Line Patterns, which will be used as the key to identify recurring paragraphs. The default and mandatory ID Line Pattern is labeled as ID Line A, which divides lines of text into paragraphs. And users have options to add more ID Line Patterns (B, C, D…) as filters to filter out unqualified paragraphs.

2.Define 0~N Variable Line Patterns to parse variables inside each recurring paragraph that has been identified by ID Line Pattern.

The parsed result of a paragraph parser is in a tabular shape. The variables defined in ID line patterns, variable line patterns, and parent line patterns (optional) will be formed as table columns.

Defining a Paragraph Parser to Parse Interface Information

Take the parsing of interface information for example. You can define a paragraph parser to parse interface information.

1.Retrieve sample text, for example:

ID Line                FastEthernet0/0 is up, line protocol is up
Variable Line        Full-duplex, 100Mb/s, 1000BaseTX/FX
                 ...
Variable Line          0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
                 ...

2.Select a parser type by clicking Add Paragraph, and click on the input box of the target ID Line.

3.Define ID Line Pattern: anchor the paragraph identifier to identify recurring paragraphs.

1)Select an interface line of text in the Sample area, and click the arrow () to duplicate it as an ID Line A.

2)Define a string-type variable by replacing FastEthernet0/0 with $intf.

3)Define a multi-string variable by replacing up with $mstring:phy_state.

4)Define a multi-string variable by replacing up with $mstring:link_state.

4.Define Variable Line Pattern: parsing variables inside each recurring paragraph and sub-paragraph that has been identified by ID Line Pattern.

1)Select Full-duplex, 100Mb/s, 100BaseTX/FX in the Sample area and click the arrow () to duplicate it as Variable Line 1.

2)In the Variable Line 1 field, replace Full-duplex, 100Mb/s, 100BaseTX/FX with $duplex(Full-duplex|Auto-duplex), $speed(100Mb/s|Auto-speed).

3)Select 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored in the Sample area, and click the arrow () to duplicate it as Variable Line 2.

4)In the Variable Line 2 field, replace 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored with $input_errors input errors, $crc CRC, $frame frame, $overunn overrun, $ignored ignored.

5.Preview the parsed result of sample text, and then click OK to save the paragraph parser.