LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   pdftotext 0.20.2: pdftotext *.pdf gives syntax error. (https://www.linuxquestions.org/questions/slackware-14/pdftotext-0-20-2-pdftotext-%2A-pdf-gives-syntax-error-4175531837/)

stf92 01-22-2015 11:14 AM

pdftotext 0.20.2: pdftotext *.pdf gives syntax error.
 
How do I fix that?

Didier Spaier 01-22-2015 11:48 AM

This is a syntax error as you are providing pdftotext several arguments but it expects either one (the pdf file) or two (the pdf file followed by the text file) see the man page.

Try this instead:
Code:

for i in `ls *.pdf`; do pdftotext $i; done

stf92 01-22-2015 11:54 AM

You beat me. I had already done it via
Code:

bill@juan:~/lectura/ldd_txt$ cat sc01

LIST=$(ls *.pdf) #ls *.wav interpretado como orden por los parentesis
for i in $LIST ; do
        INPUT=$i
       
     
              echo "Input=  $INPUT"
        pdftotext $INPUT
done
bill@juan:~/lectura/ldd_txt$

Thank you.

Didier Spaier 01-22-2015 12:01 PM

You gan get the same result a simpler way:
Code:

for INPUT in `ls *.pdf`; do echo $INPUT; pdftotext $INPUT; done

stf92 01-22-2015 12:08 PM

Quote:

Originally Posted by Didier Spaier (Post 5305093)
This is a syntax error as you are providing pdftotext several arguments but it expects either one (the pdf file) or two (the pdf file followed by the text file) see the man page.

Try this instead:
Code:

for i in `ls *.pdf`; do pdftotext $i; done

Wait a moment. The thread title should read ' pdftotext 0.20.2: pdftotext BLANK HERE *.pdf gives syntax error'. Am I missing something important?

Didier Spaier 01-22-2015 01:08 PM

Quote:

Originally Posted by stf92 (Post 5305105)
Wait a moment. The thread title should read ' pdftotext 0.20.2: pdftotext BLANK HERE *.pdf gives syntax error'. Am I missing something important?

I don't understand what you mean.

bassmadrigal 01-22-2015 01:34 PM

Quote:

Originally Posted by stf92 (Post 5305105)
Wait a moment. The thread title should read ' pdftotext 0.20.2: pdftotext BLANK HERE *.pdf gives syntax error'. Am I missing something important?

I don't know what you mean by BLANK HERE, but as Didier mentioned, pdftotext does not allow wildcards. You can't use *.pdf when using pdftotext unless you put it in a for loop, like you already did.

It looked like you already answered your own question, so what are you missing?


All times are GMT -5. The time now is 09:40 AM.