• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 561
  • Last Modified:

Concat Unix strings for file conversion in ksh

I have a file with one filename per line. Each filename has .html extension. I need to strip the extension, add a .ps extension and use both of those filenames as parameters to a conversion program. I can't get beyond syntax errors.

Currently I have:
DOCINPUTCMD="/usr/bin/htmldoc --webpage --footer ../ --headfootsize 9 --fontsize 9 --left 0.5in --right 0.3in --top 0.5in --bottom 0.5in -f

while read -r fullname
do
        echo $DOCINPUTCMD
        newfilename=`echo $fullname | cut -f1 -d'.'`
        usefile=`echo $newfilename".ps"`
        echo Executing ${DOCINPUTCMD} against file ${fullname} >> $MY_OUTPUT_FILE
        doitcmd=$DOCINPUTCMD $usefile $fullname
        echo '$doitcmd = ' $doitcmd
        $doitcmd
        $DOCINPUTCMD $usefile $fullname
        echo ${DOCINPUTCMD} $usefile $fullname

Open in new window


I want  to create something like:
htmldoc outputfilename.ps inputfilename.html

Open in new window

. Then I want to execute that command as well. Currently when I run the script I get this error: /gitst/home/gi/GI/scripts/proc_ice_reports.sh[14]: syntax error at line 41 : `"' unmatched. This error is from the line assigning a string to the var usefile.
0
Bill Whiting
Asked:
Bill Whiting
  • 3
  • 3
1 Solution
 
woolmilkporcCommented:
It's in line 1 - there's a missing terminating quote.

DOCINPUTCMD="/usr/bin/htmldoc --webpage --footer ../ --headfootsize 9 --fontsize 9 --left 0.5in --right 0.3in --top 0.5in --bottom 0.5in -f"

I assume you just didn't post the terminating "done < file_with_filenames" statement?
0
 
Bill WhitingAuthor Commented:
That's correct, there were a couple of echo statements followed by:
  done < $INFILE
0
 
woolmilkporcCommented:
Did adding the terminating quote do the trick?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Bill WhitingAuthor Commented:
No, but I wish it had. It was my error to leave the final line out of my question post, but it has been intact in my code all along.
0
 
woolmilkporcCommented:
Sorry, I think we're not talking about the same thing.

What I was referring to in my second comment is the first part of my first comment - about the missing terminating " in the first line you posted (the one starting with "DOCINPUTCMD"),  the quote which should have followed  -f

Again, for your reference:

DOCINPUTCMD="/usr/bin/htmldoc --webpage --footer ../ --headfootsize 9 --fontsize 9 --left 0.5in --right 0.3in --top 0.5in --bottom 0.5in -f"
0
 
Bill WhitingAuthor Commented:
Thanks, that was exactly the problem. Well worth the points to me so that I can get moving again. Now I see a problem with parameters to the htmldoc program, but that's another issue.

Regards,
Bill
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now