{Urgent very need help} script for conn oracle and get the content


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting {Urgent very need help} script for conn oracle and get the content
# 8  
Old 02-01-2007
Quote:
Originally Posted by anbu23
Code:
#!/bin/sh

DAY=`/export/home/oracle/bin/lastdate | nawk '{print $1}'`

/export/home/orahome/bin/sqlplus -s user/pass<<eof
set heading off;
set linesize 100;
set feedback off;

spool /export/home/oracle//log/$DAY.log
select ip,host_id from omc_ip ;
spool off;
EXIT;
eof
sed "/^[[:space:]]*$/d" /export/home/oracle/log/$DAY.log > tmp
mv tmp /export/home/oracle/log/$DAY.log 



hi anbu,

after i run the script above i still got the blank line :

10.1.0.0 LDDS-IVR-2
10.1.0.0 LDDS-CS-A
10.1.0.0 USSDGsem1
10.1.0.0 USSDGsem2
10.1.0.0 USSDGsby1
10.1.0.0 USSDGsby2
10.1.0.0 USSDGmdn1
10.1.0.0 USSDGmdn2
10.1.0.0 USSDGtbs2
10.1.0.0 LDDS-IVR-1
10.1.0.0 USSDGtbs1
10.1.0.0 LDDS-MAP-B
10.1.0.0 LDDS-CS-B

10.1.0.0 LDDS-MAP-A
10.1.0.0 USSDGtbs3
10.1.0.0 USSDGmdn3
10.1.0.0 USSDGmdn4
10.1.0.0 USSDGsby3
10.1.0.0 USSDGsby4
10.1.0.0 USSDGtbs4



any ideas?

thank you

Best Regards,

bucci
# 9  
Old 02-01-2007
#!/usr/bin/ksh
var=""
file="/dir/subdir/filename.ext"

var=`$ORACLE_HOME/bin/sqlplus -s username/password@db<<!
set pagesize 0 feedback off verify off heading off trimout on echo off
WHENEVER OSERROR EXIT SQL.OSCODE
WHENEVER SQLERROR EXIT SQL.SQLCODE
select column
from table
where columne = value
;
!`
echo ${var} >> ${file}
# 10  
Old 02-01-2007
Quote:
Originally Posted by bucci
hi anbu,

after i run the script above i still got the blank line :

10.1.0.0 LDDS-IVR-2
10.1.0.0 LDDS-CS-A
10.1.0.0 USSDGsem1
10.1.0.0 USSDGsem2
10.1.0.0 USSDGsby1
10.1.0.0 USSDGsby2
10.1.0.0 USSDGmdn1
10.1.0.0 USSDGmdn2
10.1.0.0 USSDGtbs2
10.1.0.0 LDDS-IVR-1
10.1.0.0 USSDGtbs1
10.1.0.0 LDDS-MAP-B
10.1.0.0 LDDS-CS-B

10.1.0.0 LDDS-MAP-A
10.1.0.0 USSDGtbs3
10.1.0.0 USSDGmdn3
10.1.0.0 USSDGmdn4
10.1.0.0 USSDGsby3
10.1.0.0 USSDGsby4
10.1.0.0 USSDGtbs4



any ideas?

thank you

Best Regards,

bucci
Try this
Code:
sed "/^ *$/d" file

# 11  
Old 02-03-2007
Quote:
Originally Posted by anbu23
Try this
Code:
sed "/^ *$/d" file

hi anbu,

thank so much it work

Regards,

bucci
# 12  
Old 02-22-2007
Hi,

The below script connecting to database and query the table put the o/p into file.

#!/bin/sh
var=""
file="/home/xx1/abc/filename.ext"
var=`$ORACLE_HOME/bin/sqlplus -s sd/sd@db1<<!
set feedback off;
set linesize 100;
select * from xx1;
!`
echo ${var}>>${file}


ORACLE
---------
select * from xx1

A B
P 123
Q 234
P 234

filename.ext in unix
------------------
P 123 Q 234 P 234

I want below format in that file

A B
P 123
Q 234
P 234

Please help

Thanks and Regards,
MR
# 13  
Old 02-22-2007
Code:
echo "P 123 Q 234 P 234" | tr ' ' '\n' | paste -d" " - -

# 14  
Old 02-22-2007
Hi,
I want to do it in inside the script (When executing the below script ,data loaded with column format)

Thanks and Regards,
MR
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

2. Shell Programming and Scripting

File Content Loading to Oracle Error

I habe a UNIX Variablw with content as below: WHOLE_REC_TXT="$record" where $record contains contents of file Sample contents of file: topic_id|1624|AIDS-HIV|| topic_id|1625|Allergies|| topic_id|1626|Alzheimer s|| topic_id|1627|Knee Pain|| topic_id|1628|Autism||... (2 Replies)
Discussion started by: Arun Mishra
2 Replies

3. Red Hat

Help: Find established conn source

Hi Friends, On one of my server which having direct connection to internet without firewall ..am seeing a established connection with SSH .. am not getting how ..there no login but I can see this established connection . ## have hidden original IPs with below notations for security concerns .... (0 Replies)
Discussion started by: Shirishlnx
0 Replies

4. Shell Programming and Scripting

urgent help : want to check data in oracle from flate file

Hi All, I have a flat file like this on unix AIX server: MXBOFO CSWP 5340 3794499 MXBOBIS CSWP 5340 3581124 MXBOFO CSWP 5340 3794531 MXBOBIS CSWP 5340 3583720 MXBOFO CSWP 5340 3794514 MXBOBIS CSWP 5340 3580763 MXBOFO CSWP 5340 3795578 MXBOBIS CSWP 5340 3794995 MXBOFO CSWP 5340 3710835... (3 Replies)
Discussion started by: unknown123
3 Replies

5. UNIX for Dummies Questions & Answers

Doubt in Oracle connecting unix - Very urgent

I am using a oracle query from unix.. flag=`sqlplus -s <<EOF SELECT 'Y' FROM table_name WHERE cond1 = '${table_name}' AND DECODE('${var_a}','''NA''',own,'${var_b0}')= own exception when no_data_found then dbms_output.put_line(NVL(l_owner_flag,'X')); end; EOF` Its not validating the... (7 Replies)
Discussion started by: sivakumar.rj
7 Replies

6. UNIX for Advanced & Expert Users

conn

hai , i want to connect to global ftp through ip address. remote type is unix. sometimes it is connecting some times connection timed out is coming what is solution (1 Reply)
Discussion started by: rajan_ka1
1 Replies

7. Solaris

oracle on solaris, needed urgent help, require it for exams?

Hi all, I wanted to know how to install oracle on solaris (b83).. I also would like to know of a link that i can download oracle from? please reply fast.. I need it for my exams day after tomorrow... please reply (1 Reply)
Discussion started by: wrapster
1 Replies

8. Shell Programming and Scripting

how to store the first content of the folder in a variable?(Urgent)

Hi All, I need urgent help. Because just now i have to give this code to my client. I have a folder name is Testing. this Testing folder contains the following 3 files. 1.txt 2.txt 2.txt Now I want to store the first value of my folder in a variable say suppose $a. Means i want that... (3 Replies)
Discussion started by: sunitachoudhury
3 Replies

9. Shell Programming and Scripting

Urgent: selecting unique specific content of a file using shell script

Hi, I have a file whose content and format at places is as given below. print coloumn .... coloumn .... coloumn .... skip 1 line print coloumn ... skip 1 line I need to select the following : print coloumn .... coloumn .... coloumn... (2 Replies)
Discussion started by: jisha
2 Replies

10. UNIX for Advanced & Expert Users

URGENT: Password modification for oracle user

Hi to all, Need help! For user sysoper on oracle, I want to know who and on which date/time the password has been modified? The platform is unix itself. Thanks (2 Replies)
Discussion started by: ashvik
2 Replies
Login or Register to Ask a Question