so i was doing something like this
$regex = “\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}”
Get-ChildItem $folder -Filter *.log | ForEach-Object {
$newname = $folder + “\Parsed\parsed_” + $.Name
$content = [System.IO.File]::ReadAllText($.FullName).replace($regex, “$& + text”)
and $content was not changed a bit
while this worked fine:
$regex = “\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}”
Get-ChildItem $folder -Filter *.log | ForEach-Object {
$newname = $folder + “\Parsed\parsed_” + $.Name
$content = [System.IO.File]::ReadAllText($.FullName)
$newcontent = [regex]::Replace($content, $regex, “$& text”)
and i cant really understand why? any ideas?
Thanks in advance