为了,我必须:
1)抓住从txt文件
PowerShell的得到.txt文件,抢源链接,得到的字符串,导出为CSV
http://example1.htm
HTTP各个环节:// example2.htm
HTTP://example3.htm
...
2)从每一个环节
3)获得源从源
让我的琴弦4)将字符串导出到csv
它可以使用一个链接。例如:
$topic1 = "kh_header.><b>((?<=)[^<]+(?=</b>))"
$topic2 = "<b>Numer ogłoszenia:\s([^;]+(?=;))"
Select-String -Path strona1.htm -pattern $topic1 | foreach-object {
$_.line -match $topic1 > $nul
$out1 = $matches[1]
}
Select-String -Path strona1.htm -pattern $topic2 | foreach-object {
$_.line -match $topic2 > $nul
$out2 = $matches[1]
}
echo $out1';'$out2';' | Set-content out.csv -force
,但我不能得到它与txt文件中的很多链接。我试试看:
$topic = "kh_header.><b>((?<=)[^<]+(?=</b>))"
$topic2 = "<b>Numer ogłoszenia:\s([^;]+(?=;))"
$folder = Get-ChildItem e:\sk\html
ForEach ($htmfile in $folder){
If ($_.extension -eq ".htm"){
$htmfile = ForEach-Object {
$WC = New-Object net.webclient
$HTMLCode = $WC.Downloadstring($_.fullname)
}
Select-String -Path $HTMLCode -pattern $topic | foreach-object {
$_.line -match $topic > $nul
$out1 = $matches[1]
}
Select-String -Path $HTMLCode -pattern $topic2 | foreach-object {
$_.line -match $topic2 > $nul
$out2 = $matches[1]
}
echo $out1';'$out2';' | Set-content out.csv -force
}
}
我该如何得到它?
完整的源代码示例工作的任何最终解决方案关于它 ? – Kiquenet