I think the environment can only be achieved with a win machine.
target:.
--D
- - Dow
--M
│ --Sample
│ --SampleP
--Rec
│ --Sample
V-Vi
--Sample
--Sam
This is what it looks like when the tree is displayed, and "*.txt" exists in each folder.
I would like to delete the line containing "AAA:" in the file and only break the line.
I was thinking about it in the bat file, but it's very difficult, so I wonder if it's possible with vbs and WSH.
I would appreciate it if you could let me know how it can be achieved.
PowerShell is recommended as a standard installation of Windows 7 or later.
foreach($fin Get-ChildItem.-Include*.txt-Recurse){
@(Get-Content$f)-replace".*AAA:.*", "|Set-Content$f
}
If the character code is fixed, I think I can use Powershell.
The code below removes all lines starting with AAA: in the *.txt file below C:\target
and saves them as UTF-8.
$root="C:\target"#Replaceable Folder
ls$root-Recurse-Include*.txt |%{$f=$_.FullName;$(Get-Content$f)-replace"^AAA:.*$", "|Set-Content-Encoding UTF8$f}
If you run the script above, you will see 3
from the first line of the text below.
The line is converted to a blank line.
aaa:
AAA:
AAA:B
AAB:
© 2024 OneMinuteCode. All rights reserved.