[NTLUG:Discuss] bash question
herrold
herrold at owlriver.com
Wed Sep 12 12:54:03 CDT 2001
On Wed, 12 Sep 2001, Wrenn, Bobby J. wrote:
> If I can get an answer to this I will finally be able to use Linux at work.
... hmmm a worthy cause
> I need to take 209 pdf files with spaces in the file names. and convert them
> into text. I am very new to scripting and know nothing about regular
> expressions. Is there an easy way to remove the spaces from the file names?
Testing a thought:
[herrold at pokey herrold]$ ls | tr ' ' '#' | grep \#
IP#and#PC#Names#for#Owl#River.rtf
[herrold at pokey herrold]$ ls I*
IHN.doc Image012.jpg
Interim_CEO_092799_v1.doc IP and PC Names for Owl River.rtf
... OK -- I have a method ...
> Then how do I recursively submit the files to pdftotext with the same name
> except for the .pdf changed to .txt?
for i in ` ls *.pdf | tr ' ' '_'`; do
DONAME=`basename $i .pdf`
pdftotext $DONAME.pdf $DONAME.txt
done
... untested, but it should work ... test on a copy ... backup
first, etc ...
> Just getting that much done will be a big help.
-- Russ Herrold
More information about the Discuss
mailing list