Using Matches in powershell

Multi tool use


Using Matches in powershell
I am fairly new with powershell and would like some assistance. I am pulling file locations from a CSV file, searching those files for links. Capturing the links and would like to export to a new CSV file with the matches in one column and the file they were found in another.
I am having trouble arranging my results. Any help would be appreciated.
Here is what I have so far.
$csv = Import-csv "C:Usersn609078Desktoptesting_aaronfind_test.csv"
$csv | ForEach-Object {
$path = $_.path
Select-String $path -pattern '<a href="(.*?)".*?>.*?</a>' -AllMatches |
ForEach-Object {$_.Matches.Groups[1].Value}
}
c:find_test.csv
Import-csv
Thanks ,my csv doesn't have headers. It's just one column consisting of different file locations to html files that I would like to search for links.
– A-A-Ron
yesterday
Not really a csv then..
– TheIncorrigible1
yesterday
Possible duplicate of Windows PowerShell parse HTML local file
– LotPings
yesterday
I have revised my code and added a header "path" to my csv. I'm pulling the links but still not sure how to export to new CSV. Update in original code above
– A-A-Ron
yesterday
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Welcome as a new user to SO. Please take the tour and also read How to Ask. What is the content/headers of
c:find_test.csv
? If it's a proper csv file useImport-csv
to read it into a variable.– LotPings
yesterday