Powershell and some simple string manipulation

Posted by Pat on Stack Overflow See other posts from Stack Overflow or by Pat
Published on 2012-07-10T03:12:03Z Indexed on 2012/07/10 3:15 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

need some help with building a powershell script to help with some basic string manipulation. I know just enough powershell to get in trouble, but can't figure out the syntax or coding to make this work.

I have a text file that looks like this -

Here is your list of servers:
server1
server2.domain.local
server3
Total number of servers: 3

I need to take that text file and drop the first and last lines (Always first and last.) Then I need to take every other line and basically turn it into a CSV file.

The final output should be a text file that looks like this -

server1,server2.domain.local,server3

Any suggestions on where to start? Thanks!

© Stack Overflow or respective owner

Related posts about string

Related posts about powershell