Question: Help me finish my Powershell script. Using the code below, read through the incident log file. Output the web domain for each line. $file =
Help me finish my Powershell script.
Using the code below, read through the incident log file. Output the web domain for each line.
$file = new-object System.IO.StreamReader("./Documents/OnCallIncidentLog.txt") try { while (($line = $file.ReadLine()) -ne $null) { # do something with $line here $line } } finally { $file.Close() }
Output
mtc.edu watc.org gway.org . . .
Incident Log File: (copy into .txt document from script)
Date Oncall Email Incidents 1-Jan-15 Lat.Dress@mct.edu 0 15-Jan-15 He.Weiz@watc.org 3 29-Jan-15 Wil.Jou@gway.org 6 12-Feb-15 Sam.Jan@mct.edu 6 26-Feb-15 Cas.Tard@watc.org 3 12-Mar-15 Phi.Ferr@mctc.edu 1 26-Mar-15 Ros.Derr@wat.edu 4 9-Apr-15 Ka.Shir@way.org 1 23-Apr-15 Ari.Putho@watc.org 6 7-May-15 Ros.Sarta@gway.edu 0 21-May-15 Jac.Gant@mctc.org 0 4-Jun-15 Sar.Guar@watc.edu 2 18-Jun-15 Me.Ohle@way.edu 4 2-Jul-15 Yol.Marti@mctc.org 3 16-Jul-15 Vic.Rolh@watc.org 9 30-Jul-15 To.Patri@mct.edu 0 13-Aug-15 Fre.Aras@watc.org 0 27-Aug-15 Mic.Tell@mct.edu 3 10-Sep-15 Myr.Gim@watc.edu 1 24-Sep-15 Ca.Ma@gway.org 2 8-Oct-15 Mel.Link@mctc.org 2 22-Oct-15 Val.Cald@wat.edu 9 5-Nov-15 Dar.Edmun@gway.org 4 19-Nov-15 Eli.Kenn@mctc.edu 1 3-Dec-15 Gen.Carr@watc.edu 2 17-Dec-15 Gen.Copla@mctc.org 2 31-Dec-15 Oni.Den@watc.org 2 14-Jan-16 Ra.Bes@gway.edu 0 28-Jan-16 Jan.All@mctc.org 5 11-Feb-16 Bo .Muis@watc.edu 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
