标题: [文本处理] 【已解决】批处理怎么将文本文件中的指定字符#替换为其他字符& [打印本页]
作者: 447219071 时间: 2015-10-13 16:04 标题: 【已解决】批处理怎么将文本文件中的指定字符#替换为其他字符&
本帖最后由 pcl_test 于 2016-8-8 14:55 编辑
批处理将a.txt中所有的字符”#“替换为”&“并保存
谢谢
作者: flyinnet9 时间: 2015-10-13 17:14
本帖最后由 flyinnet9 于 2015-10-13 17:15 编辑
测试了下,居然可以。。。。。。- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in (1.txt) do (
- set str=%%a
- set str=!str:#=^&!
- echo.!str!
- )
复制代码
作者: pcl_test 时间: 2015-10-13 18:10
- ::先下载http://batch-cn.qiniudn.com/tool/4.0.7/sed.exe
- sed -i "s/#/\&/g" "a.txt"
复制代码
作者: 447219071 时间: 2015-10-14 19:16
回复 2# flyinnet9
没有效果
作者: CrLf 时间: 2015-10-14 20:52
http://www.bathome.net/s/tool/?key=%E5%9B%9E%E6%94%B6%E7%AB%99
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |