批处理提取文本中指定字符中间的内容
比如2.33.1.5-->6.2.9.62fdd(g:9)goo:fdsfdsf(g:2)2.11.1.5-->6.2.9.62fdd(g:1)goo:dfdsffdsf...
比如
2.33.1.5-->6.2.9.62fdd (g:9) goo:fdsfdsf (g:2)
2.11.1.5-->6.2.9.62fdd (g:1) goo:dfdsffdsf (g:8)
2.345.1.5-->6.2.9.62fdd (g:3) goo:d6fdsfds (g:3)
2.3.43.5-->6.2.9.62fdd (g:4) goo:fdsfds (g:9)
2.3.1.3-->6.2.9.62fdd (g:7) goo:%^$#RDF (g:3)
2.3.1.2-->6.2.9.62fdd (g:0) goo:#$REFDSFD (g:1)
2.3.76.5-->6.2.9.62fdd (g:9) goo:fsdfdsefd (g:3)
我要goo:后面的
fdsfdsf
dfdsffdsf
d6fdsfds
fdsfds
%^$#RDF
#$REFDSFD
fsdfdsefd 展开
2.33.1.5-->6.2.9.62fdd (g:9) goo:fdsfdsf (g:2)
2.11.1.5-->6.2.9.62fdd (g:1) goo:dfdsffdsf (g:8)
2.345.1.5-->6.2.9.62fdd (g:3) goo:d6fdsfds (g:3)
2.3.43.5-->6.2.9.62fdd (g:4) goo:fdsfds (g:9)
2.3.1.3-->6.2.9.62fdd (g:7) goo:%^$#RDF (g:3)
2.3.1.2-->6.2.9.62fdd (g:0) goo:#$REFDSFD (g:1)
2.3.76.5-->6.2.9.62fdd (g:9) goo:fsdfdsefd (g:3)
我要goo:后面的
fdsfdsf
dfdsffdsf
d6fdsfds
fdsfds
%^$#RDF
#$REFDSFD
fsdfdsefd 展开
1个回答
展开全部
@echo off
for /f "tokens=1-5* delims=:()" %%a in (test.txt) do (
if /i "%%d"=="goo" (
set /p "s=%%~e" < nul
echo.
)
)
pause
从文本文件test.txt中输出上述内容
更多追问追答
追问
不行呀
可以保留到另外个文本不
追答
@echo off
(for /f "tokens=1-5* delims=:()" %%a in (test.txt) do (
if /i "%%d"=="goo" (
set /p "s=%%~e" < nul
echo.
)
)) > result.txt
pause
将输出保存到文件result.txt
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询