Expect - parse all occurrences of a pattern and store in a variable
0
votes
1
answer
111
views
I am trying to process multiple mac addresses from output of a program. Output is in below format -
Device B0:CA:68:CF:88:54 dev1
Device DC:16:B2:AE:FB:8F dev2
Device B0:CA:68:CF:88:11 dev3
Device DC:16:B2:AE:FB:22 dev4
I want to store mac addresses along with their names in a file
And I want to store mac addresses in a variable and process further.
I am struggling with it in Expect. How to do it ? Please help
**Below command works but only gives single Mac -**
expect -re "Device.*(\[0-9A-Z]\[0-9A-Z]:\[0-9A-Z]\[0-9A-Z]:\[0-9A-Z]\[0-9A-Z]:\[0-9A-Z]\[0-9A-Z]:\[0-9A-Z]\[0-9A-Z]:\[0-9A-Z]\[0-9A-Z])"
Asked by fatalkill3r
(1 rep)
Jan 17, 2020, 06:29 AM
Last activity: Jan 17, 2020, 02:53 PM
Last activity: Jan 17, 2020, 02:53 PM