given the following 2 lines of strings, for example :
May 22 00:46:38.340 prod-lab03c-rd1 fpc4 XETH(4/2): %PFE-6: Link 0 XFP: Low Rx power warning set
[May 24 11:24:28.299 LOG: Notice] MIC(0/1) link 1 SFP receive power low warning set
i would like to store in 3 variables the following numbers :
[1] the 1st number after the "(", it could be 1 or more digits
[2] the 1st number after the "/", it could be 1 or more digits
[3] the first number after the "(L|l)ink" word, it could be 1 or more digits
could you please assist me on this please ?
many thanks
To get the first number after the first
(, we can use.*\((\d+). Then to get the first number after the/, we can use/(\d+)\). And then to get the first number after “link”:[lL]ink (\d+). We put these together to getThe three numbers will be in the three groups