中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-27 02:24
47,812 topics / 349,912 posts / today 2 new / 48,264 members
其它操作系统综合讨论区 » How to delete part of the content in Notepad?
Printable Version  2,024 / 9
Floor1 ednykissyou Posted 2006-06-12 10:41
初级用户 Posts 88 Credits 182
I have a notepad mybook.txt.
I want to use the DOS command to delete "bookID", "bookNUM" in this notepad. How should I write the command?
Floor2 namejm Posted 2006-06-12 23:45
荣誉版主 Posts 1,737 Credits 5,226 From 成都
It is estimated that it is difficult to achieve.
Floor3 ednykissyou Posted 2006-06-13 10:26
初级用户 Posts 88 Credits 182
Well, I think it's a bit difficult too, I'll just use JavaScript then. If any big brother knows it, that would be the best.
Floor4 chineselgs Posted 2006-06-14 13:25
高级用户 Posts 266 Credits 613 From 河南省
Just re-edit it.
Floor5 kcdsw Posted 2006-06-14 13:50
中级用户 Posts 179 Credits 404
When it's a single line, you can use
for + findstr
Floor6 joyoustar Posted 2007-03-21 00:50
初级用户 Posts 45 Credits 96
I also want to know, how to find and add or delete strings or entire lines in Notepad?
Floor7 9527 Posted 2007-03-21 01:28
银牌会员 Posts 438 Credits 1,185 From 北京
There is no content in mybook.txt, which is not good for writing...
Floor8 vkill Posted 2007-03-21 01:55
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Floor9 lxmxn Posted 2007-03-21 02:07
版主 Posts 4,938 Credits 11,386

  If there is content of mybook.txt, maybe JavaScript and third-party tools can be avoided.
Floor10 ZJHJ Posted 2007-03-29 10:57
高级用户 Posts 374 Credits 609
@echo off
:: Preserve blank lines and replace strings (Note: If replacing a batch program, the identifier ":" will be lost, and "=" cannot be replaced)
echo.
set /p waei= Drag the file whose characters you want to replace to this window:
echo.
set /p wasy= Enter the text to be replaced:
echo.
set /p sybm= Enter the replacement text:
echo.
echo The program is running, please wait... ...
set "waei=%waei:"=%"
for %%i in ("%waei%") do set waei=%%~fi
cd.>"%waei%_tmp.txt"
setlocal enabledelayedexpansion
for /f "tokens=1* delims=:" %%i in ('findstr /n .* "%waei%"') do (
set str=%%j
if not "!str!"=="" set "str=!str:%wasy%=%sybm%!"
>>"%waei%_tmp.txt" echo.!str!
)
copy "%waei%" "%waei%_bak.txt" >nul 2>nul
move "%waei%_tmp.txt" "%waei%"
@cls
@echo.
@echo Replacement completed
pause>nul
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023