![]() |
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-05 18:36 |
48,039 topics / 350,124 posts / today 2 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Problems with text and letter substitution in files? |
| Printable Version 6,039 / 29 |
| Floor1 zouzhxi | Posted 2006-10-15 10:36 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
Can this function be realized to replace English letters in a text file with the characters I want?
For example: I want to replace the letter R with "日" and r with "人", etc.... I can control that a certain letter is replaced with a specific character... !!!! [ Last edited by namejm on 2006-10-15 at 11:10 ] |
|
| Floor2 不得不爱 | Posted 2006-10-15 10:48 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
What exactly do you want to replace?
|
|
| Floor3 electronixtar | Posted 2006-10-15 10:52 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Use Notepad. If you need to use regular expressions, UltraEdit is sufficient.
|
|
| Floor4 namejm | Posted 2006-10-15 10:54 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
As long as you want to replace a certain letter with a specified character, it's all feasible under CMD - except for replacing it with sensitive characters. Please post the specific content you want to convert.
In addition, please don't make the font size too large. Although you may be in a hurry, too large a font size will take up too much space and cause inconvenience to the forum management. |
|
| Floor5 zouzhxi | Posted 2006-10-15 11:05 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
I want to replace the following characters
correspondingly with the following text
That's it. It's that simple... |
|
| Floor6 namejm | Posted 2006-10-15 11:09 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Please list out your alphabet conversion list completely. Without listing it out, I can't write the code.
|
|
| Floor7 不得不爱 | Posted 2006-10-15 11:10 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
Then you might as well use Notepad to complete it
|
|
| Floor8 lxmxn | Posted 2006-10-15 12:01 |
| 版主 Posts 4,938 Credits 11,386 | |
|
It is strongly recommended that the thread starter use Notepad or other third-party text editing tools to complete this task. If you use batch processing to solve it, this will cost a lot of brain cells. I hope the thread starter thinks twice. |
|
| Floor9 namejm | Posted 2006-10-15 12:47 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Actually, it is feasible to solve it with batch processing, and the efficiency is relatively high. For example, the following code can realize part of the functions of the 5th floor (because partial replacement will be executed multiple times and lead to inaccurate results, so some replacement rules are removed):
|
|
| Floor10 redtek | Posted 2006-10-15 21:42 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
Why does it seem like the code of the original poster is like the code of a self - created input method? Haha...
[ Last edited by redtek on 2006 - 10 - 15 at 21:43 ] |
|
| Floor11 zouzhxi | Posted 2006-10-15 22:51 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
TO redtek:
This is a file someone gave me. They told me that as long as I replace the letters and numbers inside with specific characters, I can find out what it is. I have no way either. TO lxmxn: You said to use Notepad. What if there are a lot (that is, more than the above. It's too tedious to replace one by one.) |
|
| Floor12 zouzhxi | Posted 2006-10-15 23:10 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
Originally posted by namejm at 2006-10-15 12:47: Why is there no case insensitivity when using it... How to solve this??? [ Last edited by zouzhxi on 2006-10-15 at 23:11 ] |
|
| Floor13 kingchain | Posted 2006-10-15 23:55 |
| 初级用户 Posts 57 Credits 133 | |
| Floor14 无奈何 | Posted 2006-10-16 00:08 |
| 荣誉版主 Posts 356 Credits 1,338 | |
|
Your question is most suitable for the tr command under Linux & Unix. sed can also complete the function of tr. Try the following code:
Sed download address: http://www.student.northpark.edu/pemente/sed/gsed407x.zip |
|
| Floor15 zouzhxi | Posted 2006-10-16 01:35 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
I want to use batch processing to implement...!!!
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |