China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-07 19:04
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [fixed] Looking for a tool to batch replace characters in text View 930 Replies 5
Original Poster Posted 2008-03-09 21:41 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
Replace multiple characters in text
Replace Search.gif with http://tireless.blogbus.com/files/12050652183.gif
Replace SR.gif with http://tireless.blogbus.com/files/12050652185.gif
...many more

[ Last edited by tireless on 2008-11-29 at 20:22 ]
Floor 2 Posted 2008-03-09 21:46 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Search the forum for "change"
Floor 3 Posted 2008-03-09 21:52 ·  中国 福建 福州 连江县 联通
高级用户
★★
Credits 581
Posts 277
Joined 2006-12-23 05:10
19-year member
UID 74328
Gender Male
Status Offline
Searching more is the proper way

http://www.cn-dos.net/forum/viewthread.php?tid=17395

http://www.cn-dos.net/forum/viewthread.php?tid=17669

[ Last edited by suntb on 2008-3-9 at 09:54 PM ]
Floor 4 Posted 2008-03-09 22:34 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
Many thanks. But it's still very troublesome, I have to write 32 lines like this
CHANGE.EXE test.txt /from BlueTop.gif /to http://www.blogbus.com/user/images/s.gif
Floor 5 Posted 2008-03-10 00:30 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Originally posted by tireless at 2008-3-9 10:34 PM:
Many thanks. But it's still very troublesome, I have to write 32 lines like this
CHANGE.EXE test.txt /from BlueTop.gif /to http://www.blogbus.com/user/images/s.gif

Why not put the from content and the to content into a text file, then read that file in a for loop, and call change?
Floor 6 Posted 2008-03-12 13:29 ·  中国 广西 南宁 电信
初级用户
Credits 115
Posts 45
Joined 2007-03-03 10:09
19-year member
UID 80655
Gender Male
Status Offline
I often need to do character replacement on several thousand web page files. Back then, all the tools I found had graphical interfaces, and doing this kind of thing was simply a nightmare.
Until one day I found the command-line tool sed, only a few dozen KB in size. What used to be a huge project suddenly became child's play from then on—one command, ten seconds!

sed -i "s/原字符/新字符/g" *.htm
Forum Jump: