?
Solved

Oracle Printer Driver saves to folder location -- need to rename extension too

Posted on 2012-03-21
8
Medium Priority
?
786 Views
Last Modified: 2012-03-22
I currently have a printer driver set up in Oracle R12 that saves the output to a directory rather than sending to a pring using the following as the argument

mv $PROFILES$.FILENAME /var/tmp/Oracle_Reports/XXC3_RESP_AUD_RPT/

This works fine.  However, the file is an Excel file with an extension of .EXCEL rather than .XLS or .xls.  I would like to use the above command to also rename the extension, but have not been successful as of yet.
0
Comment
Question by:DRSLT
  • 4
  • 4
8 Comments
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37750379
My unix is rusty but you should be able to use sed to change the extension.

Try the code below, I got the original from:
http://lab.artlung.com/unix-batch-file-rename/


mv $PROFILES$.FILENAME var/tmp/Oracle_Reports/XXC3_RESP_AUD_RPT/`echo $PROFILES$.FILENAME | sed 's/\(.*\.\)EXCEL/\1XLS/'`
0
 
LVL 1

Author Comment

by:DRSLT
ID: 37751983
slightwv

Thanks for the update.  This renames the file with the new extension, but it also includes the original UNIX path of the file as part of the filename.  $PROFILES$.FILENAME is the original path + filename, so your code tries to rename it to the following

/var/tmp/Oracle_Reports/XXC3_RESP_AUD_RPT/<ORIGINAL UNIX PATH>+<BASE FILENAME>.xls

which throws an error since that path doesn't exist.  I need to pull the filename from $PROFILES$.FILENAME and the solution would work.

Any ideas???
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37752127
Wouldn't it just be the $.FILENAME?  try just removing $PROFILES:

mv $PROFILES$.FILENAME /var/tmp/Oracle_Reports/XXC3_RESP_AUD_RPT/`echo $.FILENAME | sed 's/\(.*\.\)EXCEL/\1XLS/'`
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:DRSLT
ID: 37752314
$.FILENAME is a litteral without $PROFILES preceding it.  I was hoping to use basename to get rid of the UNIX folder, but that does not seem to be working.

Thanks for the advice so far.  Still looking for the solution.  Any additional suggestions appreciated.
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37752356
I guess I'm not understanding what $PROFILES$.FILENAME is and where it comes from.

So .FILENAME is what produces .EXCEL?

Can this be 2 steps?

First the mv above then maybe something like (remember my unix is from memory):
mv /var/tmp/Oracle_Reports/XXC3_RESP_AUD_RPT/*.EXCEL *.XLS
0
 
LVL 1

Author Comment

by:DRSLT
ID: 37752403
It is a parameter in a the UNIX print command from Oracle.  It is the name of the file being output to the printer.  It is in a UNIX directory and we are using the mv command to move it to a windows system directory (which works great).  The problem is renaming the extension.

The argument $PROFILES$.FILENAME is the <UNIX path>  + <FILE> being passed to the printer.  In this case the printer driver is set up to move the file to the windows system directory by specifying the mv command in the argument for the printer driver.

==================================================================================

Passing Arguments to UNIX lp Print Command

 Argument Syntax  Token and Value Retrieved  
 
-d$PROFILES$.PRINTER -d calls out the destination printer.  $PROFILES$.PRINTER retrieves the operating system name of the printer associated with the request.  
 
-n$PROFILES$.CONC_COPIES -n calls out the number of copies to print.  $PROFILES$.CONC_COPIES retrieves the value of the profile option Concurrent:Report Copies, unless this value is updated at runtime.  
 
-t"$PROFILES$.TITLE" -t calls out the report title to print on a banner or header page.  "$PROFILES$.TITLE" retrieves the title of the output file, typically titled as Application username.Request ID. For example, if user John Smith ran a report whose concurrent request ID was 64225, the title would be JSMITH.64225. This is operating system dependent.  
 
$PROFILES$.FILENAME  $PROFILES$.FILENAME calls out the filename of the report to be printed. The value retrieved is the output file name, including the path to the file.  

(from http://docs.oracle.com/cd/A60725_05/html/comnls/us/fnd/custom01.htm)
0
 
LVL 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 37752422
Thanks for that.  It helped a lot.

See if basename is on your system:
http://www.unix.com/unix-dummies-questions-answers/42159-remove-path-filename.html

mv $PROFILES$.FILENAME /var/tmp/Oracle_Reports/XXC3_RESP_AUD_RPT/`basename $PROFILES$.FILENAME | sed 's/\(.*\.\)EXCEL/\1XLS/'`
0
 
LVL 1

Author Closing Comment

by:DRSLT
ID: 37752593
Thanks for your help.  As I indicated previously, I wanted to use basename, but I must not have been getting the syntax right.  Your last post did it!

Thanks a lot!  Points coming your way.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
Progress
Introduction to Processes
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question