I'm trying to match and replace a string in a file that changes daily.
REM Break#1
LOI 0712 232400 2324 0004 001 001 000030 000000 00000000 000 00SWIFFER28 0000
LOI 0712 232400 2324 0004 001 002 000030 000000 00000000 000 00SWIFFER28 0000
REM Break#1
LOI 0712 232800 2328 0004 001 001 000030 000000 00000000 000 00SWIFFER28 0000
LOI 0712 232800 2328 0004 001 002 000030 000000 00000000 000 00SWIFFER28 0000
The string that I'd like to match and replace is "LOI 0***" The LOI 0 will stay but the *** will change. I've tried variations of the following with no luck:
$D = Get-Date -Format d $D.replace("/","") -replace("2016","") $D = $D.replace("/","") -replace("2016","") $C1 = Get-ChildItem -Path C:\*64001.SCH $C2 = Get-ChildItem -Path C:\*64Z01.SCH Rename-Item -Path $C1 $D'64001.SCH' Rename-Item -Path $C2 $D'64Z01.SCH' Get-Content C:\*64001.SCH | ForEach-Object { $_ -replace "LOI 0???","LOI 0'$D'"} | set-content c:\*64001.SCH
How can I modify the last line to edit those trailing 3 characters after "LOI 0"?
Thanks,
Brian
-Brian