I need to remove double quote in a text file, only if lines start with "https". File contents is like this:
...
"bla, bla, bla"
"https://example.com"
"bar, bar, bar"
...
I've to match "https://example.com", remove both double quotes, leaves the double quotes in other lines, than set-content in place...
I've tried many methods but I'm stuck bacause I don't know how to handle double quotes in a regex, or declaring a filter in "if" or "where" statement and than replace text in place...
Latest try:
$TextFile = Get-Content "e:\file.txt"
foreach ($Line in $TextFile) {if ($Line.StartsWith('"https')) { $line.trim('"')} | Set-Content $TextFile
But not works...
I've read this post and this but I don't understand how to fit these solutions to my needs..
Can Someone help me please?