I am trying to get the last 10 lines of a file using windows command-prompt, cmd.exe.
I am able to get the number of lines in the file using the for
loop/delim. The problem is I need to subtract 10
from %G
and pass that to the chained more
command. But the variable last10
is either not getting set
or not passing to the more
command.
for /f "tokens=3 delims=: " %G IN ('find /v /c "" file.log') DO (set /a "last10=%G-10" & more file.log +%last10%)
How can I get the variable last10
correctly in the more
command?