|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『楼 主』:
文件的文字与字母替换问题?
使用 LLM 解释/回答一下
我想对一文本文件里边有英文字母替换成我想要的字符,这个功能能实现吗?
比如:我想对字母R替换成"日",r替换成"人"等等。。。
可以让我自己控制某个字母替换成特定字符。。。
!!!!
Last edited by namejm on 2006-10-15 at 11:10 ]
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 ]
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-10-15 10:36 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
|
2006-10-15 10:48 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
用记事本嘛。要用 正则的话用UltraEdit 即可
Use Notepad. If you need to use regular expressions, UltraEdit is sufficient.
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-10-15 10:52 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
只要你想把某个字母换成指定字符,在CMD下都是可行的——换成敏感字符除外。请把你要转换的具体内容帖出来。
另外,请不要把字号弄得太大。虽然你可能很着急,但是字体太大会很占版面,给论坛的管理带来不便。
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.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-15 10:54 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
我就是想把下面这段字符
M1QJZSHQ200D00A01e01e00WCWB00WIBC00W01H00W02901A01B01D01A01901D01901E01A02B00D00A01e01e00WDe100WIBC00W01H00W02902K01F02K01B02K02b02M01F02B00D00ALBPC11CWBIBC00W01H00W02901B01B01801D01901901801G01F01D01701F01801A01B01G01E01902B00D00AF89IIcMY6N9W00W01H00W02902e02T02Z02d02N02e02M02B00D00AF89IIcIW2Fa500W01H00W02902e02T02Z02d02N02e02M02J02S02L02B00D00ADcMCGCM1FIYD00W01H00W02902e02T02Z02e02M02c02N01N01801D01A01502H02T02R02B
相对应的换成下面文字
A=啊 a=阿 B=不 b=把 C=才 c=出 ……
0=a 1=o 2=e 3=u 4=i 5=u 6=v 7=l 8=b 9=y
就可以了。就这么简单...
I want to replace the following characters
M1QJZSHQ200D00A01e01e00WCWB00WIBC00W01H00W02901A01B01D01A01901D01901E01A02B00D00A01e01e00WDe100WIBC00W01H00W02902K01F02K01B02K02b02M01F02B00D00ALBPC11CWBIBC00W01H00W02901B01B01801D01901901801G01F01D01701F01801A01B01G01E01902B00D00AF89IIcMY6N9W00W01H00W02902e02T02Z02d02N02e02M02B00D00AF89IIcIW2Fa500W01H00W02902e02T02Z02d02N02e02M02J02S02L02B00D00ADcMCGCM1FIYD00W01H00W02902e02T02Z02e02M02c02N01N01801D01A01502H02T02R02B
correspondingly with the following text
A=Ah a=A B=No b=Put C=Only c=Out ……
0=a 1=o 2=e 3=u 4=i 5=u 6=v 7=l 8=b 9=y
That's it. It's that simple...
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-10-15 11:05 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
请把你的字母转换清单列完,不列完没法写代码。
Please list out your alphabet conversion list completely. Without listing it out, I can't write the code.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-15 11:09 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
|
2006-10-15 11:10 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
强烈建议楼主用记事本或者其它的第三方文本编辑工具完成这个任务,如果用批处理来解决的话,这样将会死很多脑细胞。
望楼主三思而行。
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.
|
|
2006-10-15 12:01 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
其实用批处理来解决是可行的,并且效率也比较高。比如,用如下代码就可以实现第5楼的部分功能(因为部分替换会多次执行而导致结果不准确,所以剔除了部分替换规则):
@echo off
cd.>2.txt
setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set var=%%i
set "var=!var:A=啊!"
set "var=!var:a=阿!"
set "var=!var:B=不!"
set "var=!var:b=把!"
set "var=!var:C=才!"
set "var=!var:c=出!"
set "var=!var:1=o!"
set "var=!var:2=e!"
set "var=!var:3=u!"
set "var=!var:4=i!"
set "var=!var:5=u!"
set "var=!var:6=v!"
set "var=!var:7=l!"
set "var=!var:9=y!"
>>2.txt echo !var!
)
start 2.txt
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):
@echo off
cd.>2.txt
setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set var=%%i
set "var=!var:A=啊!"
set "var=!var:a=阿!"
set "var=!var:B=不!"
set "var=!var:b=把!"
set "var=!var:C=才!"
set "var=!var:c=出!"
set "var=!var:1=o!"
set "var=!var:2=e!"
set "var=!var:3=u!"
set "var=!var:4=i!"
set "var=!var:5=u!"
set "var=!var:6=v!"
set "var=!var:7=l!"
set "var=!var:9=y!"
>>2.txt echo !var!
)
start 2.txt
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-15 12:47 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
怎么觉得楼主这个编码象是 自创输入法的编码啊?哈哈……
Last edited by redtek on 2006-10-15 at 21:43 ]
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 ]
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-10-15 21:42 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
TO redtek:
这是别人给我的一个文件,,告诉我说,只要用特定字符替换掉里边的字母数字就可以知道是什么东东了.我也没办法,,,,
TO lxmxn:
你说用记事本,如果有很多(就是说比上面的多呢.一个一个替换太烦人了.)怎么办.
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.)
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-10-15 22:51 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
Originally posted by namejm at 2006-10-15 12:47:
其实用批处理来解决是可行的,并且效率也比较高。比如,用如下代码就可以实现第5楼的部分功能(因为部分替换会多次执行而导致结果不准确, ...
@echo off
cd.>2.txt
setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set var=%%i
set "var=!var:A=啊!"
set "var=!var:a=阿!"
set "var=!var:B=不!"
set "var=!var:b=把!"
set "var=!var:C=才!"
set "var=!var:c=出!"
set "var=!var:1=o!"
set "var=!var:2=e!"
set "var=!var:3=u!"
set "var=!var:4=i!"
set "var=!var:5=u!"
set "var=!var:6=v!"
set "var=!var:7=l!"
set "var=!var:9=y!"
>>2.txt echo !var!
)
start 2.txt
怎么用起来大小写不分...这怎么解决???
Last edited by zouzhxi on 2006-10-15 at 23:11 ]
Originally posted by namejm at 2006-10-15 12:47:
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, resulting in inaccurate results,...
@echo off
cd.>2.txt
setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set var=%%i
set "var=!var:A=啊!"
set "var=!var:a=阿!"
set "var=!var:B=不!"
set "var=!var:b=把!"
set "var=!var:C=才!"
set "var=!var:c=出!"
set "var=!var:1=o!"
set "var=!var:2=e!"
set "var=!var:3=u!"
set "var=!var:4=i!"
set "var=!var:5=u!"
set "var=!var:6=v!"
set "var=!var:7=l!"
set "var=!var:9=y!"
>>2.txt echo !var!
)
start 2.txt
Why is there no case insensitivity when using it... How to solve this???
Last edited by zouzhxi on 2006-10-15 at 23:11 ]
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-10-15 23:10 |
|
|
kingchain
初级用户
 
积分 133
发帖 57
注册 2006-3-15
状态 离线
|
|
2006-10-15 23:55 |
|
|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
你的问题用 linux & unix 下的 tr 命令再合适不过了。
sed 也可以完成 tr 的命令,试试下面的代码:
sed "y/AaBbCc0123456789/啊阿不把才出aoeuiuvlby/" file.txt
sed 下载地址:http://www.student.northpark.edu/pemente/sed/gsed407x.zip
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 "y/AaBbCc0123456789/啊阿不把才出aoeuiuvlby/" file.txt
Sed download address: http://www.student.northpark.edu/pemente/sed/gsed407x.zip
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2006-10-16 00:08 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
|
2006-10-16 01:35 |
|