Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Split a file between two line

$
0
0

I have a file with a random amount of entries of report names.  The last line and the line prior to the reports are always the same.

IE:

$FTPListStart = "------------------------------------------------------------------------------"
$FTPListEnd = "*** END OF REPORT FOR REPORTS"

I want to create a array based on the lines between the above lines.  How do I accomplish this?

I tried: 

$Reports = ((Get-Content $FileSource).Split($FTPListStart)[1]).Split($FTPListEnd)[0]

Obviously it didn't work. 


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>