在使用Windows批处理脚本分号的文件替换标签 [英] Replace tabs in a file with semi-colons using Windows batch script

查看:239
本文介绍了在使用Windows批处理脚本分号的文件替换标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想file.How做呢,在我的数据分号来代替所有的制表符?

I want to replace all the TAB characters with semi-colons in my data file.How do I do that?

我希望能够做到这一点使用Windows(MS-DOS)批处理脚本。

I want to be able to do that using Windows (MS-DOS) batch script.

推荐答案

您可以使用此的 BatchSubstitute 功能。

You could use this BatchSubstitute function.

或者为您的特殊情况下,简单一点这种替换设置页;

Or a bit simpler for your special case this replaces TAB with ;

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
)

这篇关于在使用Windows批处理脚本分号的文件替换标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆