in this form:
1 1
2 2
3 4
6 7
9 12
each line has two numbers separated by a space, the left column of numbers is a start page, and the right column numbers is the end pages.
As you can senn in the 4th line it start with the page number 6 but the set of number before it end with the page 4 "the page 5 is missing". and so is the 5th line.
what i need is a code that fix the missing page numbers if exist.
you can separate each column in a separate file and do the work.
I mad this code but it work on assumbtion that the left and right column is the same,
so it take each number and subtract 1 and make it as a new value but it has a downfall,
it end with a list starting from 0 and it substract every value even the one that doesn't need to be changed.
Code: Select all
For /R %%z in (Folder\Bookmarks\*.txt) Do (
For /F "tokens=*" %%a in (Folder\range\%%~nz\tmp_max.txt) Do (
call :check "Folder\range\%%~nz\max.txt" max %%a
)
)
:: this work as follow:
:: call :function_name "output_file" "assaigned_variable" "list_of numbers"
:check
set %2=%3
:loop
if "%3" equ "" goto :eof
set /a max=%3 - 1
if !max!==0 set max=%3
echo !max!>>%1
goto loop
forgot to say the list must be in this form, "1 2 3 5 6 88 98"
i convert a virtecal list to horizontal using this commad
Code: Select all
For /F "tokens=1,2 delims= " %%a in ('type "Folder\all.txt"') Do (
<nul set /p "=%%b ">>Folder\max_range.txt
)