In the following thread:
batch to copy last line of several .txt files into 1 new .txt file and appends file name on new line
...dbenham offered a solution to another poster, which works perfectly for my needs.
@echo off
setlocal enableDelayedExpansion
>output.txt (
for %%F in (*.log) do (
<nul set /p "=%%F: "
for /f %%N in ('type "%%F"^|find /c /v ""') do set /a skip=%%N
if !skip! gtr 0 set /a skip-=1
more +!skip! "%%F"
)
)
type output.txt
My question: Can the syntax above be modified to copy the THIRD line of each *.txt file in the directory, append the filename of each file to the line, and send the results to a new output file?
Thanks kindly.