Since you are familiar with the UDFs look for wshpipe().

Then, using your example it would be something like the following:

untested:
 Code:
for each $line in wshpipe('netstat',1)
  if len($line)>0
    ? $line
  endif
next


If you are needing to read text files, search for readfile().

Same idea as above:
untested:
 Code:
for each $line in readfile('file.txt')
  if len($line)>0
    ? $line
  endif
next