shell - How to read file names from a txt file in cmd prompt(script) and then combine a subset of the files into a PDF file using the cmd line in windows -
i have text file in following format:
2014-05-13 03:35 pm 48,841 sur2-**c01**-00-000-pce-1001-002.pdf 2014-05-13 03:36 pm 43,599 sur2-**c01**-00-000-pce-1002-001.pdf 2014-05-13 03:35 pm 51,900 sur2-**c02**-00-000-pce-1000-001.pdf 2014-05-13 03:35 pm 53,622 sur2-**c02**-00-000-pce-1000-002.pdf 2014-05-13 03:35 pm 52,145 sur2-**c02**-00-000-pce-1000-003.pdf 2014-05-13 03:35 pm 50,426 sur2-**c02**-00-000-pce-1000-004.pdf
i need parse file, , pull out files match c01 or c02, , send these files combined pdf file, 1 c01 , 1 c02.
how can parse file, , string match file names on c01 or c02?
then, how can take above parse result, , using file names found, combine them pdf command line or in script?
merge-c01.bat
1.use awk parse file array
set list=($(awk '/c01/{print $5}' file.txt))
2.use pdf merge tool (pdftk) merge files in array
for %%i in %list% pdftk out.pdf %%i cat output out.pdf
Comments
Post a Comment