Linux Script to copy and rename files through SQL statement
Hi,
I require help to complete below requirement through Linux Script.
I have a SQL query which shows two columns as output. One is Report Name and other is report path. Query return multiple rows. below is the output.
Now requirement is to copy the file from output path to /opt/reports
further rename the report name which is in output path after out/ with .out extension
with the name in Report name column.
So script will copy the files and rename them in a loop, so that all the records available in the select statement will be copy and renamed.
below is the SQL Query.
Last edited by vbe; 11-13-2017 at 04:53 AM..
Reason: code tags...
I have a few to questions pose in response first:-
Is this homework/assignment? There are specific forums for these.
What have you tried in your script so far?
What output/errors do you get?
What OS and version are you using?
What are your preferred tools? (C, shell, perl, awk, etc.)
What logical process have you considered? (to help steer us to follow what you are trying to achieve)
How do you get the report names? I don't see it in your SQL.
Can I presume that the headings in bold do not actually appear in your output? If they do, i don't see where your SQL generates them.
Most importantly, What have you tried so far?
There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.
We're all here to learn and getting the relevant information will help us all.
Hi,
for your queries blow is the response.
Is this homework/assignment? There are specific forums for these.
This is assignment
What have you tried in your script so far?
Well, i am new to linux, if have tried to copy cp and rename files.
What output/errors do you get?
currently unable to initialize output of SQL Query in script
What OS and version are you using?
Linux Red Hat 5.8
What are your preferred tools? (C, shell, perl, awk, etc.)
shell
What logical process have you considered? (to help steer us to follow what you are trying to achieve)
How do you get the report names? I don't see it in your SQL.
in SQL (pt.user_concurrent_program_name ) is the report name. system generate the report and saves its name and output path in a table
Can I presume that the headings in bold do not actually appear in your output? If they do, i don't see where your SQL generates them.
actually bold heading are the column name of the table
Regards,
---------- Post updated at 06:24 AM ---------- Previous update was at 06:13 AM ----------
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.
Please review the rules, which you agreed to when you registered, if you have not already done so.
More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.
#!/bin/sh
sqlplus -s "/ as sysdba" << EOF
SET HEADING OFF
SET FEEDBACK OFF
Select
pt.user_concurrent_program_name , OUTFILE_NAME
FROm
apps.fnd_concurrent_programs_tl pt,
apps.fnd_concurrent_requests f
where
pt.concurrent_program_id = f.concurrent_program_id
and pt.application_id =... (1 Reply)
Is better way to write the script loop through one by one "Old_File_1: & New_File_1:" to copy 100 files to /staging/test folder then re-name & gzip all those files? I wrote this code below and don't like that much. Thanks
I have a control_file under /tmp/test folder like below 100 files and... (10 Replies)
I need to pull down a good bit of files for another support team for an upgrade project. I have a server.list with all of the server names.
I need to do two parts:
FIRST:
I have this example, but it does not list the server name in front of each line.
#! /bin/bash
for server in $(<... (10 Replies)
Hi,
I need help in shell scripting. If someone can help me, that would be great!
Problem. I want Linux Script to compare two folders and copy missing files.
Description.
I have two directories
/dir1
/dir2
I need to copy all distinct/new/unique/missing files from /dir1 and that... (1 Reply)
Hi All,
I am new to scripting and am looking for some assistance setting up a script. Basically I need the script to scan a folder for the newest files and make a copy of those files, adding a month to the date stamp. I also need this script to delete the previously copied files to save space.... (4 Replies)
hello,
I am write a Script and i would listing all Files from Path1 out with DSR*.txt and give a new name an copy to the Path2.
I have problems with that to rename. Someone can help me?
Sorry, for my english. My english is not gut.
I hope you understand my.
That is my Script.
... (2 Replies)
hello, I need to build a shell script that receives the folder to copy by parameter and copy all files except thumb.db to another folder and rename them like, file.jpg renamed to file_bb1.jpg.
can someone help me
Thanks (4 Replies)
I have few webservers logs like access.log. which would be growing everyday.
what i do everyday is, take the backup of access.log as access.log_(currentdate) and nullify the access.log.
So thought of writing a script... but stuck up in middle.
My requirement: to take the backup and nullify... (6 Replies)
Hi all,
I am a newbie in writng unix..I am using ksh shell..Does anyone know how to copy a list o files from directory A to directory B with differnt names? i.e
in Dir A, I have
RPT101.555.TXT
RPT102.666.TXT
and I want to copy those files to dir B with new naming convention..
in Dir B,... (7 Replies)