Complex query


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Complex query
# 1  
Old 07-07-2011
Question Complex query

A file whose location i am not aware of contains the below text
Code:
<url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP)
(HOST=ngm2sn1p2-vip.mybank.net)(PORT=4001))(ADDRESS=(PROTOCOL=TCP)(HOST=ngm2sn2p2-vip.mybank.net)
(PORT=4001)))(CONNECT_DATA=(SERVICE_NAME=besttable)(FAILOVER_MODE=(TYPE=select)(METHOD=basic))(DELAY=180)(RETRIES=5)))</url>

I need to grep strictly for these two strings together "oracle:thin" and in the result just need to display "HOST=ngm2sn1p2-vip.mybank.net" "PORT=4001" for every entry found in any file and ignoring the duplicate entries for combined HOST and PORT.

Below is what i wish to extend in order to achieve the above.
Code:
find ./ -type f | xargs grep "oracle:thin"

Your help is appreciated.

Last edited by vbe; 07-07-2011 at 12:42 PM..
# 2  
Old 07-07-2011
Are the host and port constants or you just need any first host and port defined in the jdbc connection string?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Complex Query regarding folder size

Hi, I provide the path to a folder. I would like so drill in each folder inside the folder i gave and show me the size in human readable form du -sh <folder-name> of the top 8 folders with maximum sizes. For example: Path of the folder: "/opt/app/myapp" has these directories. ls... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

Complex if then else

for i in $(condition ONE);do for e in $(CONDITION TWO);do if ; then command 1 command 2 command 3 else if ; then command 1 command 2 command 3 else if ; then ... (6 Replies)
Discussion started by: elilmal
6 Replies

3. Shell Programming and Scripting

Complex variable

If I need the output as below, what syntax I should use. I use only korn shell. =========In file =========================== #!/usr/bin/ksn P1=cat P2=dog P3=bat for i 1 2 3 do echo $P$i # <---------- This line is the problem I face. What I should use. done ========= End of file... (5 Replies)
Discussion started by: kkakarot
5 Replies

4. Shell Programming and Scripting

Complex string search query.

Hi, I wish to find the latest occurance of the below string in my log file. Once found, I need to search the below string after the above string and display this Request 331489 has passed or Request 331489 has failed I would like my query to be platform... (11 Replies)
Discussion started by: mohtashims
11 Replies

5. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

6. Web Development

Complex MySQL Query(s)

Hi all, I have a bit of an issue, I am working on a bit of a CMDB for a friend, it's to do with real estate. Anyway, this is my situation. I have a table which contains all the properties (forsale, sold, etc) in the DB named "property". Now, this is what I want to achieve, I wish to... (5 Replies)
Discussion started by: STOIE
5 Replies

7. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

8. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

9. Solaris

how to complex.h in C on SUN

Hi, The C code we've written work ok on Mac, but make a " segmentation fault" when running on SUN. One potential bug is complex.h because the complex.h in the lib/ is licensed by Apple. Does anybody know how to add in complex.h into lib/ on the SUN so we can deal with complex numbers in our code?... (3 Replies)
Discussion started by: xtong
3 Replies

10. Programming

Need help with complex SQL query (Sybase)

Hello, I have three tables. I need an SQL query (preferably Sybase) that will return all of the stringID values of table B where the following conditions exist: (1) B.intID = A.intID (2) B.intID != C.intID or (B.intID = C.intID and (C.v1 = 0 or C.v2... (2 Replies)
Discussion started by: chatieremerrill
2 Replies
Login or Register to Ask a Question