新行作为FOR循环的代号 [英] New line as a delimeter of FOR loop

查看:84
本文介绍了新行作为FOR循环的代号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是批处理脚本的新手,我试图解析一个文件,该文件的键值(种类)为成对的行,并用新行分隔.例如:

I am new to batch script, and I am trying to parse a file that has key value (kind) of pairs delimited by new line. For example:

the value of abc
1234
the value of def
5678
the value of ghi
9876

我想使用新行作为分隔符来读取此文件,以便可以访问这些值.

I would like to read this file using new line as delimited so that I can access the values.

类似

for /f "tokens=1,2,3 delims='\n'" %%i in ('findstr /C:the value of abc 'filepath') do echo %%j

推荐答案

我只是将其作为选项:

for /F delims^=^ eol^= %%i in ('findstr /C:the value of abc 'filepath') do echo %%i

这篇关于新行作为FOR循环的代号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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