Can someone help me understand what is happening in this command please ?
I get the first part, find IPv4 in IPConfig the the select first IPv4 that is in the list, but what is happening here 1).split(':').trim() ? I want to be able to use these type of skills as i learn, but its confusing !
That's quite a one-liner, but I think we can walk through it easily enough.
[b].Split()[/b] is a string method and is acting on the output of the pipeline in parentheses just before it. It takes a string and splits it up using a specified character as a delimiter, in this case a colon. After the split is done, you are left with a collection of strings instead of a single string:
Now you have two strings in a collection but you are only interested in one of them, so we use the index (square brackets) operator to get the second string. Collections are zero-indexed so the first item is 0, the second is 1 and so on: