Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file findstr/v正在删除空间和dote不工作_Batch File - Fatal编程技术网

Batch file findstr/v正在删除空间和dote不工作

Batch file findstr/v正在删除空间和dote不工作,batch-file,Batch File,我有以下批处理文件: cd /d "T:\R\YOU" for /r T:\R\YOU %%i in (.) do echo %%~nxi>>D:\MultiThreading\ReadFile.txt cd /d D:\MultiThreading rem I want to remove dots and spaces for the file content findstr /v "." ReadFile.pbd >> 11.txt findstr /v " "

我有以下批处理文件:

cd /d "T:\R\YOU"

for /r T:\R\YOU %%i in (.) do echo %%~nxi>>D:\MultiThreading\ReadFile.txt

cd /d D:\MultiThreading
rem I want to remove dots and spaces for the file content
findstr /v "." ReadFile.pbd >> 11.txt
findstr /v " " 11.pbd >> 12.txt

pause
我从读取的文件中获得了正确的输出,但是
12.txt的输出是空的,我做错了什么

这是
ReadFile.txt
文件的输出:

YOU
YOU 14.1.33333
YOU 14.1.44444
YOU 14.1.55555
YOU 14.1.44444
我想要这样的输出(我想要删除第一行):


以下代码段读取文件
ReadFile.txt
跳过第一行,删除每行的空格和点,并将结果输出到名为
ReturnFile.txt
的文件中:

@echo关闭
setlocal EnableExtensions DisableDelayedExpansion
>“ReturnFile.txt”(
对于/F“usebackq skip=1 delims=“%%L in”(“ReadFile.txt”)do(
设置“行=%%L”
setlocal EnableDelayedExpansion
设置“行=!行:=!”
设置“行=!行:.=!”
回声(!线!
端部
)
)
端部
退出/B

有点原始,答案相当简短。

findstr
只能搜索字符串,不能修改字符串;请改用…@aschipfl我使用findstr,因为在
find
/
findstr
中存在此问题;
/V
开关返回包含至少一个未编辑匹配项的所有文本行;
/V
开关反转输出,因此不包含匹配项的行将不经编辑地返回;这允许筛选文本文件的某些行。您希望删除某些字符,因此无法使用这些命令…我感到困惑。在上一个问题中,您说希望列出文件。您现在使用的FOR/R命令是枚举文件夹,而不是文件。
YOU14133333
YOU14144444
YOU14155555
YOU14144444
@Echo off
For /f "usebackq Tokens=1-10 delims=. " %%A in ("ReadFile.txt"
  ) Do If "%%B" Neq "" Echo:%%A%%B%%C%%D%%E%%F%%G%%H%%%I%%J