Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
615 views
in Technique[技术] by (71.8m points)

windows - What delimiter to use in FOR loop for reading lines?

I have a txt file that contains the following lines

jfo3 93jfl
lvls 29fdj
nskd jfuwe
xlkw eklwe

I'm trying to read the file line by line, and do something with it. What delimiter should I use?

The delim I'm using here reads each word separately.

@echo off
setlocal EnableDelayedExpansion
for /f "delims=" %%x in (lines.txt) do (
    echo %%x
)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This reads line by line for me:

for /f "delims=" %x in (lines.txt) do echo %x

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...