This is my solution for Beginner Event 3
Here we have to parse a file and split it into two and rename the original file
1: # Read the input file
2: $InputFile = ".\Shot Put.txt"
3: #Get the content of the file
4: $Content = Get-Content $InputFile
5:
6: #create the two files
7: $outfile1 = ".\Shot Put A.txt"
8: $outfile2 = ".\Shot Put B.txt"
9:
10: #We now parse the file and divide it
11:
12: {
13: if ($line -match "^\s*$") #We have reached the end of a paragraph
14: foreach ($line in $Content)
15: {$outfile = $outfile2}
16: else
17: {$line >> $outfile1} #The rest we put into the first file
18: }
19:
20: #Rename the file
21: Rename-Item -path '.\Shot Put.txt' -newname '.\Shot Put.old'