Post by ArnoGreat, thanks a lot, this solution is much easier, than this what I
have tried, and it works for blanks too. The only thing, what I want to
ask addtional is, it seeems so, that I can't count the lines in the
same step, because 'for' skip empty lines. So, do I have to do the line
count separat, or is it also possible in one step?
regards
Arno
It would help if you were to say what you want to do rather than leaving us
to guess.
Batch processing is unlike conventional programming. The facilities
available are OS-dependent and the methodology often depends the content of
the data to be processed.
If you want to process blank lines with a FOR /F for instance, for NT/2K/XP
(for which a better group is arguably alt.msdos.batch.nt) then because, as
you have observed, FOR /F skips blank lines, then you have to press other
techniques into play.
for /f "tokens=1*delims=[]" %%i in ('find /n /v "" filename.txt') do call
:next %%j
for instance will call the parameter-counting routine with EACH line of
filename.txt, empty or not (incidentally, if you pass %%i to :next, %%i will
contain the line-number)
This technique is not required if you don't have blank lines, and the
processing performed by the :next routine may have problems with some
characters that may be contained in filename.txt.
It's a lot easier to use
for /f "delims=" %%a in (file.txt) do call :next %%a
than
for /f "tokens=1*delims=[]" %%i in ('find /n /v "" filename.txt') do call
:next %%j
but the latter is a sledgehammer to crack a nut in the simple case - and
would then be almost inevitably be followed by a question "how do I ignore
blank lines?"
If you were to reveal what you're trying to do, your OS and relevant data
contents, then we're more able to help. Otherwise, it becomes a game of
twenty questions.
HTH
...Bill