批处理文件:从.tsv文件中删除回车 [英] Batch File: Removing carriage return from .tsv file
问题描述
我正在尝试使用批处理文件从.tsv文件中删除回车符.这就是我的.tsv文件的外观,第一行是列行
I am trying to remove carriage return from .tsv file using batch file. This is how my .tsv file looks, the first line is a column line
* ** [CR] 和 [LF] 以获得想法
Class Name & Address Item lbs Value Pickup/Drop off Date: 23 Sep[CR][LF]
Class1 Ben Coha[CR]
2305 E LA st[CR]
VISIA, PA[CR]
932112-4422 Health and beauty product / cologne body wear for men 0.13 19[CR][LF]
Class2 mich marce[CR]
255 rid court[CR]
prince frick, PA[CR]
20442 health and beauty product / cologne body wear for women 1.5 47
我希望此文件如下所示:[我仅使用记事本删除[CR]的内容(无任何替换)
I want this file as below [I used notepad to remove('replace' by nothing) occurrences of [CR] only]
Class Name & Address Item lbs Value Pickup/Drop off Date: 23 Sep[LF]
Class1 Ben Coha 2305 E LA st VISIA, PA 932112-4422 Health and beauty product / cologne body wear for men 0.13 19[LF]
Class2 mic marce 255 rid court prince frick, PA 20442 health and beauty product / cologne body wear for women 1.5 47
我尝试了以下批处理文件.文件被放在一行中.它将删除回车和换行.
I tried following batch file. file is being put in one single line. It removes both carriage return and line feed.
@echo off
SetLocal DisableDelayedExpansion
for /f "delims=" %%a in (myFile.tsv) do (
echo/|set /p ="%%a%"
)>>newMyFile.tsv
结果看起来像..
Class Name & Address Item lbs Value Pickup/Drop off Date: 23 SepClass1 Ben Coha 2305 E LA st VISIA, PA 932112-4422 Health and beauty product / cologne body wear for men 0.13 19 Class2 mic marce 255 rid court prince frick, PA 20442 health and beauty product / cologne body wear for women 1.5 47
我想修改.bat文件,以便仅删除\ r而不是同时删除\ r \ n
I want to modify the .bat file so that it only removes \r instead of removing both \r\n
更新:某种程度上我能够添加图像,这将使思路更清晰.相似的.tsv文件希望它像这样
Update: Somehow I am able to add images, this will give clearer idea. Similar .tsv file want it to be like this