The only help-file example of using @LINE on redirected standard input is
However, the assumption is that, if myfile.dat is, forexample:
Therefore, here's an example to process STDIN in a batch file:
(echo %@line[con,0]) < myfile.dat
which does work.However, the assumption is that, if myfile.dat is, forexample:
a
b
c
, then(echo 0=%@line[con,0] 1=%@line[con,1] 2=%@line[con,2]) < myfile.dat
"should" echo0=a 1=b 2=c
. Instead it echos (bug??)0=a 1=c 2=**EOF**
. It should be documented that the way to make this example work is:(echo 0=%@line[con,0] 1=%@line[con,0] 2=%@line[con,0]) < myfile.dat
0=a 1=b 2=c
. Apparently STDIN cannot be "rewound" after being accessed. This means that @LINES[CON] can never be used because it "consumes" all of STDIN.Therefore, here's an example to process STDIN in a batch file:
set i=-1
do until "%[linecon%i]" == "**EOF**"
do until "%[linecon%i]" == "**EOF**"
set i=%@INC[%i]
set linecon%i=%@LINE[CON,0]
enddo
set linecon%i=
set linescon=%@DEC[%i]
set linecon%i=%@LINE[CON,0]
enddo
set linecon%i=
set linescon=%@DEC[%i]