powershell - Iterating through a variable line by line -


i have small script outputs text variable. need go through line 1 in order parse it. outputting variable text file , reading using get-content seems bit redundant.

my script connects fortigate unit , runs query. it's response i'm looking parse.

new-sshsession 10.0.0.138 -port 65432 -credential (get-credential) -acceptkey $command = 'config router policy show' $result = invoke-sshcommand -index 0 -command $command 

by description, variable string newlines. can turn array of single-line string calling this:

$result = $result -split "`r`n" 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -