Tell me, please, as in Poweshell, “humanely” handle an array of strings, which is obtained as a result of the output of some external command. Here and on other sites you can find complete examples of how to convert an array of objects into an array of strings. But to perform the reverse operation? For example, an external exe-shnik gives such a conclusion, you need to determine uuid by name:
uuid : 111-111-111 name : name1 description : description1 uuid : 222-222-222 name : name2 description : ... uuid : 123-123-123 name : name21 description : description21 ... Solution to the forehead:
for ( $i = 0; $i -lt $exe_result.Count; $i++ ) { if ($exe_result[$i].endswith("искомое имя")) { $exe_result[$i-1]} } But this method is only suitable for a given set of parameters, when we know for sure that the name follows the uuid and only look for one parameter. How to make the sampling procedure more universal? Convert to an array of objects, a two-dimensional array?