Value PREFIX (\d+\.\d+\.\d+\.+\d+\/\d+) Value Required,List NEXTHOP (Drop|Receive|Attached|\d+\.\d+\.\d+\.\d+) Value List INTERFACE (\S+) Start ^Prefix.*Next.*Interface.*Labels.*Partial.*Install\s*$$ -> FIB # N5K doesn't have Partial Install field ^Prefix.*Next.*Interface.*Labels\s*$$ -> FIB FIB # Start Record on encountering a Prefix, don't substitute any values yet ^\*?(\d+\.\d+\.\d+\.+\d+\/\d+) -> Continue.Record # Match lines with all Values present, some entries can start with * (for multiple entries in RIB, one in FIB prefixes) ^\*?${PREFIX}\s+${NEXTHOP}\s+${INTERFACE}\s*$$ # Match lines which do not have an interface, strange but can exists ^\*?${PREFIX}\s+${NEXTHOP}\s*$$ # Match lines which have Nexthop and interface, and fill in the list; these are for prefixes which have multiple equal cost paths ^\s+${NEXTHOP}\s+${INTERFACE}\s*$$ # Match other lines before erroring out on unknown input lines ^\s*$$ ^[-+]*$$ ^. -> Error