Reputation: 81
*A:Dut-C# show stats gx
output of above command
*A:Dut-C# show stats gy
output of above command
*A:Dut-C# show stats s11
output of above command
*A:Dut-C# show stats s12
output of above command
*A:Dut-C# show stats s5
output of above command
*A:Dut-C# show stats s1u
output of above command
*A:Dut-C#
What will be the regular expression if I want to search for the above strings in a huge file and then capture output of each interface (gx,gy,s11,s12,s5,s1u, etc.) stats?
I tried following regex but it is still not complete:
*/([*A-Za-z]:Dut-[a-zA-Z]{1}#\sshow stats\s(gx|gy|s11|s12|s5|s1u)|[\r])/g*
Couldn't figure out how to do this.
Upvotes: 0
Views: 43
Reputation: 81
This solution worked :
A:Dut-C#\sshow\sstats\s(\w+)[$\s\n]+([=\n:a-zA-Z0-9! \-\.]+\* indicates that the corresponding row element may have been truncated.)
flags : global
Demo : https://regex101.com/r/gl5aHA/5
Upvotes: 1
Reputation: 887
Your pattern seems to work. You need to look in group 1 to find the captured string.
Here is an alternative solution:
a:dut-\w#\sshow\sstats\s(\w+)
Upvotes: 0