EVE-NG Linux VM SSH troubleshooting
September 20, 2025
TextFSM: parsing non-tabular text
Many network devices provide two commands to retrieve specific information: the first command returns a summarized output in tabular format,
Many network devices provide two commands to retrieve specific information: the first command returns a summarized output in tabular format, while the second command provides a more detailed view, typically in a non-tabular format where each entry is separated into a specific section.
Although the tabular format is more human-readable, non-tabular text is significantly easier for a machine to interpret.
Let’s look at an example: the show interfaces command displays detailed information about the interfaces configured on a switch.
The first step is to identify the pieces of information we’re interested in, each of which must be associated with a RegEx. Here are a few examples:
- Interface, which is mandatory and serves as the key: \w+/\d+/\d+
- Bandwidth, which is a string delimited by a comma: [^,]+
- Description, which is a generic string ending at the end of the line: .+
- Line status, which is one of several possible strings: up|down|administratively down
- MAC address, which consists of three hexadecimal sequences separated by dots: ([0-9a-f.]{4}.){2}[0-9a-f]{4}
- MTU, which is a number: \d+
- Protocol status, which is one of several possible strings: up|down
- Interface type, which is a string delimited by a comma: [^,]+
Continue reading the post on Patreon .