Forum Discussion
Shree2280
Jan 27, 2021Brass Contributor
extract http data
Hi expert, I am trying to extract http:// URL from given file but getting empty file in export here is the code $items = Get-ChildItem -LiteralPath "E:\Backup_Testinstance\" | Where-Obje...
farismalaeb
Jan 27, 2021Steel Contributor
I had created a file and add the sample you provide
and using this code, was able to get the result with only http://websitename without spaces
$items=(($x=Get-Content -Path C:\test.txt).split(";") | where {$_ -like "http://*"})
foreach ($item in $items){
($item.split(" "))[0]
}
Shree2280
Jan 29, 2021Brass Contributor
- farismalaebJan 30, 2021Steel Contributor
What is the error you are getting, Are you sure that Powershell is running as Administartor.
cause usually the Get-Content will throw an Access Denied exception if reach the file was blocked, but not running the command it self.