Batch file 使用Windows批处理脚本将文件中的选项卡替换为分号
我想用分号替换数据文件中的所有制表符。我该怎么做 我希望能够使用Windows(MS-DOS)批处理脚本完成此操作。您可以使用此功能 或者,对于您的特殊情况,这将用Batch file 使用Windows批处理脚本将文件中的选项卡替换为分号,batch-file,Batch File,我想用分号替换数据文件中的所有制表符。我该怎么做 我希望能够使用Windows(MS-DOS)批处理脚本完成此操作。您可以使用此功能 或者,对于您的特殊情况,这将用替换选项卡 setlocal DisableDelayedExpansion for /f "delims=" %%A in ('"findstr /n ^^ myFile.txt"') do ( set "line=%%A" setlocal EnableDelayedExpansion set "line=!l
替换选项卡
代码>
setlocal DisableDelayedExpansion
for /f "delims=" %%A in ('"findstr /n ^^ myFile.txt"') do (
set "line=%%A"
setlocal EnableDelayedExpansion
set "line=!line:*:=!"
if defined line (
set "line=!line: =;!"
(echo(!line!)
) ELSE echo(
endlocal
)
从一些GNU实用程序的UnxUtils本机Win32端口安装sed
然后试试这个
sed "s/\t/;/g" input.txt >output.txt
自动热键将一个值替换为另一个值的版本
#Env
SendMode Input
SetWorkingDir %A_ScriptDir%
FileSelectFile, filname,3,%A_ScriptDir%\*.csv, comma-separated values (*.csv)
FileRead, content, %filname%
Outputvar := regexreplace(content,";",",") ;Thisone replaces ; with ,
;Outputvar := regexreplace(content,"\x20{3,}",",") ;Thisone replaces 3 spaces or more with ,
FileDelete %filname%
FileAppend, %Outputvar%, %filname%
#环境
发送模式输入
设置工作目录%A\u脚本目录%
FileSelectFile,filname,3%A\u ScriptDir%\*.csv,逗号分隔值(*.csv)
文件读取,内容,%filname%
Outputvar:=regexreplace(内容,;,,,);这个取代了;具有
;Outputvar:=regexreplace(内容,“\x20{3,}”、“,”);此选项将3个或更多空格替换为,
文件删除%filname%
FileAppend,%Outputvar%,%filname%