Delete a specific string in a file at the command prompt
To delete a specific string in a file at the command prompt, write
set removeMoji=aaa set del= setlocal enabledelayedexpansion for /f "delims=" %%a in (a.txt) do ( set line=%%a echo !line:%removeMoji%=%del%! >> a_after.txt ) endlocal
We are for-ing a.txt one line at a time.
If there is a letter aaa, it is deleted and re-created in a_after.txt.
コメント