I have a list of urls in a text file
I want to pull just the domain out.
Running the following:
(Get-Content "c:\temp\test.txt") | ForEach-Object {$url = New-Object System.uri $_;$url.Host} > d:\test.txt
It generates this error:
New-Object : Exception calling ".ctor" with "1" argument(s): "Invalid URI: The format of the URI could not be determined."
And the text file is just that domain (and just the domain, not the path following the domain) over and over again.
Any thoughts on where I'm monkeying this up?
Sample File:
lrp.mxptint.net
lrpush.apxlv.com
lsa.measure.ly
lsa.measure.ly\lsa.js?1449665894174&meta_keywords=Life%2C%20lifestyle%2C%20fashion%2C%20beauty%2C%20Vancouver%2C%20British%20Columbia%2C%20family%2C%20relationships%2C%20home%2C%20blogs%2C%20news%2C%20jobs%2C%20content%2C%20pets%2C%20food%2C%20beauty&autofire=true&windowlocation=www.vancouversun.com\life\diversions lsa.measure.ly\lsa.js?1449665960913&meta_keywords=horoscopes&autofire=true&windowlocation=news.nationalpost.com\category\life
test.txt?