Script to create files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to create files
# 1  
Old 08-31-2011
Script to create files

Requirement:-

SQLs

select name from v$datafile;
select name from v$controlfile;
select name from v$tempfile;
select MEMBER from v$logfile;

These sqls has to run in one script and o/p of each sql has to write in seperate files.But the o/p is like if we issue
select name from v$datafile; o/p like

/path/datafilename1
/path/datafilename2
-------------------

So need to change the o/p as

rm -rf /path/datafilename1
rm -rf /path/datafilename2

like that all sql o/p has to come like this and write in seperate files,so that can execute that files only

please help to create a script for the same

Last edited by Sanal; 08-31-2011 at 09:46 AM..
# 2  
Old 08-31-2011
Code:
#!/bin/bash
echo "select 'rm -rf '||name from v\$datafile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file1
echo "select 'rm -rf '||name from v\$controlfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file2
echo "select 'rm -rf '||name from v\$tempfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file3
echo "select 'rm -rf '||MEMBER from v\$logfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file4

This User Gave Thanks to sulti For This Post:
# 3  
Old 08-31-2011
thanksss
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create a list of files from alias by script

Actually I have many pictures with diferent name and size around 2000, I need generate a copy of them from one list of alias. The structure of the list is something like this: alias_list.txt <01>randomname.png<02> Randomname.png RandoMname.png RandOmname.png RandomnamE.png... (6 Replies)
Discussion started by: Tapiocapioca
6 Replies

2. Shell Programming and Scripting

How to create or convert to pdf files from csv files using shell script?

Hi, Can anyone help me how to convert a .csv file to a .pdf file using shell script Thanks (2 Replies)
Discussion started by: ssk250
2 Replies

3. Shell Programming and Scripting

[Solved] How to create a script by combing two files?

I am trying to generate a csv file for utilization of each project directory. there are 10 filesystem and for each filesystem there are 16 directory. i was trying to create a script so i created two file. one is filesystem and one is project. so file looks like cat filesystems /app1 /app2... (10 Replies)
Discussion started by: anshu ranjan
10 Replies

4. HP-UX

Need help to create a script to delete the files

Hi All, I want to delete all core* files in below file system in Unix server. File system: /usr/sap/P01/JC00/j2ee/cluster/server0 I want to setup a cron job every ten minutes to delete the core *files Thanks N Rao (2 Replies)
Discussion started by: YNRao24
2 Replies

5. Shell Programming and Scripting

Need help to create a script to delete the files

Hi All, I want to delete all core* files in below file system in Unix server. File system: /usr/sap/P01/JC00/j2ee/cluster/server0 I want to setup a cron job every ten minutes to delete the core *files Thanks N Rao This thread duplicates another thread with the same title: Need... (1 Reply)
Discussion started by: YNRao24
1 Replies

6. Shell Programming and Scripting

How to create a script to compare 2 files?

I have two files File1 and File2 will contains same number of fields. The rows in File1 can be found anywhere in File2. If any rows from File1 doesn't match to File2 then write those records to a File1 log file. If any rows from File2 doesn't match to File1 then write those records to a File2... (6 Replies)
Discussion started by: ranjanp
6 Replies

7. Shell Programming and Scripting

script to create files on solaris 10

Hello, To learn ZFS, i try to create pool . and for that i want create 10 files with 512MB (because i dont have multiple disks and multiple controllers) ADMIT THAT THIS IS TEN HIGH-PERFORMANCE HARD DRIVES To get this 10 files,all of them have the same size : 512MB, I do these... (0 Replies)
Discussion started by: herbich1985
0 Replies

8. Shell Programming and Scripting

how to create the files dynamically in c shell script

how can i CREATE a txt file dynamically in c shell: for instance: #! /bin/csh for each i (*) cat>file$i.txt for each j do .... (1 Reply)
Discussion started by: jdsignature88
1 Replies

9. Shell Programming and Scripting

Require script to create two files

Hi folks, I have a input.file with the following contents:- flor geor enta vpal domi pegl cars mted four rose annc gabi ward dalv elph beac (8 Replies)
Discussion started by: mithalr
8 Replies

10. Shell Programming and Scripting

Need to create a script to show what files in what folders

Hi everyone, I'm stuck with this scenario where our system creates files every night and puts them in several folders according from whom it came from. I have managed to create a script which will list the folders in one column and the files that are in them in another column, now my problem... (6 Replies)
Discussion started by: kumaran21
6 Replies
Login or Register to Ask a Question