i am doing some automation w.r.t cmd and with the results i obtained in CMD i need to fetch some values
in the resultant text of cmd i need to see word called Disk Stats (red/write) if found i need to extract the second instance of UTIL val which is 100% at the last… i am trying from my end… any guidance from your end would help
=> Store your cmdOutput in a variable say cmdOutput.
=> Use an If condition and give like below:
If
cmdOutput.Contains("Disk Stats (red/write)")
Then
Assign -> utilValues = System.Text.RegularExpressions.Regex.Matches(cmdOutput, "UTIL\s*:\s*\d+%")
(utilValues is of DataType System.Collections.Generic.IEnumerable(System.Text.RegularExpressions.Match))
Assign -> secondUtilValue = If(utilValues.Count >= 2, utilValues(1).Value, "Not Found")
(secondUtilValue is of DataType System.String)
Else
secondUtilValue = "Disk Stats (red/write) not found"
End If
Option 1:(aggutil|Util)=(\d+\.\d+)%
You need to provide the keywords
Option 2:(aggutil)=(\d+\.\d+)%
You need to provide one keyword base
How can we do use implement it in your project?
1 First, read the CMD 2 Read The text via Regex we have added 2.1 Chcek the keyword using contain “Disk Stats (red/write)” System.Text.RegularExpressions.Regex.Matches("Pass your CMD text",(aggutil)=(\d+\.\d+)%)
**3 ** Save the data in your output
@devasaiprasad_K , We are added the UiPath Xaml file, which return one value, @devasaiprasad_K you need to modify according to your logic or I have updated in steps