Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2012-03-21
8
Medium Priority
?
781 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 77

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 77

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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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 77

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 77

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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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?
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

618 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