Hello. I have some folders (test1, test2 etc) each one containing one file called node.txt. I would like to copy some of the lines of each node.txt in another file (finaldata.txt). The aim is to have one file (finaldata.txt) contining lines 11-17 (out of 18) of each node.txt in sequential order. Someone can help me?
Thanks
:: 1117.bat 2020-12-03 14:27:18.52
@echo off > OUT.TXT & setLocal enableDELAYedeXpansioN
> IN.TXT dir/b/s node.txt
:main
for /f "tokens=* delims= " %%a in (IN.TXT) do (
call :sub1 %%a
) >> OUT.TXT
goto :eof:sub1
set N=
for /f "tokens=* delims= " %%i in (%1) do (
set/a N+=1
if !N! geq 11 if !N! leq 17 echo.%%i
)
goto :eof
::====== script ends here ======================================
M2
Let me try to send this to the 'programming' forum where the smart people hang out.
Well, they haven't moved it yet. If they don't by tomorrow you may want to just make a new posting there.
mebbe:
:: ---------- script start
@echo off & setlocal
for /f "tokens=*" %%a in ('dir /b /s node.txt') do more +11 %%a >>finaldata.txt
::---------- script end
This still leaves one line per file, all lines 18, in the accumulator file, that needs to be removed or replaced. Run script from the root of all the test- files.message edited by nbrane
:: 1117.bat 2020-12-03 14:27:18.52
@echo off > OUT.TXT & setLocal enableDELAYedeXpansioN
> IN.TXT dir/b/s node.txt
:main
for /f "tokens=* delims= " %%a in (IN.TXT) do (
call :sub1 %%a
) >> OUT.TXT
goto :eof:sub1
set N=
for /f "tokens=* delims= " %%i in (%1) do (
set/a N+=1
if !N! geq 11 if !N! leq 17 echo.%%i
)
goto :eof
::====== script ends here ======================================
M2
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |