中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » 请教:如何用批处理修改文件中特定行的字符?
作者:
标题: 请教:如何用批处理修改文件中特定行的字符? 上一主题 | 下一主题
wlyh
初级用户




积分 195
发帖 27
注册 2003-8-21
状态 离线
『楼 主』:  请教:如何用批处理修改文件中特定行的字符?

近期在精简xp的安装盘,要修改安装配置文件,手工修改容易出错,想利用批处理来做.大致情况如下:
在一个inf文件中有如下内容:
prc.nls      = 1,,83748,,,,,2,0,0
prcp.nls     = 1,,83748,,,,,2,0,0
big5.nls     = 1,,66728,,,,,2,0,0
bopomofo.nls = 1,,82172,,,,,2,0,0
;;imegen.tpl   = 100,,156672,,,,,2,0,0             (我需要在这里添加;
;;imegen.chm   = 1,,,,,,,21,3,3
;;imegen.exe   = 100,,88576,,,,,2,3,3
netus.hlp    = 1,,,,,,,2,1,0
mfc40chs.dll = 1,,,,,,,2,0,0,mfc40loc.dll
mfc42chs.dll = 1,,,,,,,2,0,0,mfc42loc.dll
又如:
[AddReg]
;;HKCU,"Control Panel\Appearance\Schemes","%BRICK%",0x00030001,\
     02,00,00,00,03,00,00,00,01,00,00,00,0d,00,00,00,0d,00,00,00,12,00,00,00,12,\
     00,00,00,f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,00,\
     00,86,00,00,00,00,8b,5b,53,4f,00,00,61,00,6c,00,00,00,58,9a,f0,77,3f,00,3f,\
     00,3f,00,3f,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,78,00,1c,10,fc,7f,\
     22,14,fc,7f,b0,fe,12,00,00,00,00,00,00,00,00,00,98,23,eb,77,0f,00,00,00,0f,\
     00,00,00,f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,00,\
     00,86,00,00,00,00,8b,5b,53,4f,00,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,\
     00,53,00,61,00,6e,00,73,00,20,00,53,00,65,00,72,00,69,00,66,00,00,00,f0,77,\
     00,20,14,00,00,00,00,10,80,05,14,00,f0,1f,14,00,00,00,14,00,12,00,00,00,12,\
     00,00,00,f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,00,\
     00,86,00,00,00,00,8b,5b,53,4f,00,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,\
     00,53,00,61,00,6e,00,73,00,20,00,53,00,65,00,72,00,69,00,66,00,00,00,14,00,\
     88,fb,e8,77,02,02,00,00,ac,b9,f0,77,00,00,00,00,20,00,00,00,f4,ff,ff,ff,00,\
     00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,00,00,86,00,00,00,00,8b,5b,\
     53,4f,00,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,53,00,61,00,6e,00,73,\
     00,20,00,53,00,65,00,72,00,69,00,66,00,00,00,00,00,00,00,00,00,00,00,00,00,\
     00,00,00,00,7c,6b,e8,77,00,00,00,00,f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,\
     00,00,00,90,01,00,00,00,00,00,86,00,00,00,00,8b,5b,53,4f,00,00,72,00,6f,00,\
     73,00,6f,00,66,00,74,00,20,00,53,00,61,00,6e,00,73,00,20,00,53,00,65,00,72,\
     00,69,00,66,00,00,00,00,00,06,00,00,00,18,00,00,00,ff,ff,ff,ff,f0,4b,21,fc,\
     00,c4,f0,77,f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\
     00,00,86,00,00,00,00,8b,5b,53,4f,00,00,72,00,6f,00,73,00,6f,00,66,00,74,00,\
     20,00,53,00,61,00,6e,00,73,00,20,00,53,00,65,00,72,00,69,00,66,00,00,00,14,\
     00,0b,00,00,00,00,ff,12,00,50,00,00,00,c0,fe,12,00,0c,10,00,01,e1,e0,d2,02,\
     42,00,00,00,80,00,00,00,8d,89,61,00,c2,bf,a5,00,ff,ff,ff,00,00,00,00,02,00,\
     00,00,00,00,00,00,00,e1,e0,d2,00,c2,bf,a5,00,c2,bf,a5,00,e1,e0,d2,00,8d,89,\
     61,00,ff,ff,ff,00,c2,bf,a5,00,8d,89,61,02,8d,89,61,02,00,00,00,00,e1,e0,d2,\
     00,e1,e0,d2,02,00,00,00,02,c2,bf,a5,02,80,00,00,00,e1,e0,d2,00,c0,c0,c0,00,\
     80,00,00,02,b0,74,40,00,c8,b8,70,00

我找到一些相关内容,其中的批处理是这样的:
......
echo sfmanm.sys>> txtsetup.log
echo ac97ali.sys>> txtsetup.log
echo ac97via.sys>> txtsetup.log
echo essm2e.sys>> txtsetup.log
findstr /v /b /i /g:txtsetup.log i386\txtsetup.sif > txtsetup.sif
move txtsetup.sif i386\txtsetup.sif
del txtsetup.log

这样处理的结果似乎是把相关行从文件中删除,(不敢确定),哪位懂得恳请详细解说.不胜感激!

[此贴子已经被作者于2004-8-10 07:22:33编辑过]




2004-8-10 00:00
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
wlyh
初级用户




积分 195
发帖 27
注册 2003-8-21
状态 离线
『第 2 楼』:  

难道没人知道?哪怕是一点建议呢?

2004-8-12 00:00
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
wchong
银牌会员




积分 1186
发帖 510
注册 2004-7-30
状态 离线
『第 3 楼』:  

急什么?谁不忙?

2004-8-12 00:00
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
GOTOmsdos
铂金会员

C++启程者


积分 5154
发帖 1827
注册 2003-7-18
状态 离线
『第 4 楼』:  

我看了半天你没说清楚意图
你要举个例子,比如 把什么什么文件1.XXX的什么字符ABC改成什么DEF.....
你现在只是把四个文件的名字定向到一个文件中,然后再在另一个文件中搜索这四个文件名(TXTSETUP.LOG中的内容仅仅是四个文件名呀),这有什么用? 没有搜索字符串呀!

[此贴子已经被作者于2004-8-12 14:20:59编辑过]




2004-8-12 00:00
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: