Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Get the tnsnames.ora alias for a given service name Post 303046188 by MadeInGermany on Monday 27th of April 2020 02:06:31 PM
Old 04-27-2020
Quote:
Originally Posted by kpg
...

I think the first line skips over the tnsnames.ora until it finds a pattern 'variable ='. So this will give us the left hand side in $1?
The second line searches for the SERVICE_NAME entry, where the value matches s, which is set on the command line to be 'pri'.
You store this in $1 ....but didn't we keep the left hand side there?

... I do not understand the third line at all.
I forgot that ( is special in ERE, that awk uses. You found it: needs to be escaped. An alternative would be [(].

Each code line is a condition { action }.
All three code lines are run for each input line.
If the condition in the 2nd code line is true it performs the action: print variable a.
This is set in the 3rd code line to field#1, if it does not have a ( at the beginning.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to capture the service name from tnsnames.ora and create connect string

ghkjkjoj (4 Replies)
Discussion started by: chetankelvin
4 Replies

2. UNIX for Dummies Questions & Answers

ORA-12154: TNS:could not resolve service name

Hi everyone, when i run ; sqlplus -s username/password@TTTEST @umt.sql i take "ORA-12154: TNS:could not resolve service name" i want to run "umt.sql" query and also see result. thanx for your helping. (6 Replies)
Discussion started by: temhem
6 Replies

3. UNIX for Dummies Questions & Answers

find tnsnames.ora in unix

Can we find out what is the location of tnsnames.ora file used by the hp unix. (3 Replies)
Discussion started by: Sudipshib
3 Replies

4. Solaris

maxuprc and maxusers - ORA-27300, ORA-27301, ORA-27302

Hi all, Am intermittently getting the following errors on one of my databases. Errors in file /oracle/HRD/saptrace/background/hrd_psp0_13943.trc: ORA-27300: OS system dependent operation:fork failed with status: 12 ORA-27301: OS failure message: Not enough space ORA-27302:... (1 Reply)
Discussion started by: newbie_01
1 Replies

5. Shell Programming and Scripting

sed: parsing tnsnames.ora

All: Can sombodoy help me out with a sed command? Assume I have the following: PRI = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.3.7)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pri) ... (3 Replies)
Discussion started by: BeefStu
3 Replies

6. UNIX for Advanced & Expert Users

grep all ORA errors except one ORA error

Hi - I am trying to grep all "ORA" errors in a log files.I have to grep all ORA errors except one error for example ORA-01653.How can exclude that error in "grep" command? In following "grep" command I want to exclude "ORA-01653" error grep -i ORA alert.log >>/tmp/ora_errors.txt ... (7 Replies)
Discussion started by: Mansoor8810
7 Replies

7. Shell Programming and Scripting

Tnsnames.ora

Hi, I would like to modify, in script schell, the line right above (DESCRIPTION and check three cases : if line contain ".world" then line=line-".world" concat "," concat line if line dont contain ".world" then line=line concat "," concat line concat".world" else line=line Keep in... (10 Replies)
Discussion started by: elcaro
10 Replies

8. Shell Programming and Scripting

Removing section from tnsnames.ora

Hi, I am trying to write a script or command to remove a section from tnsnames.ora file in the following example I would like to remove tns_alias2 section $ cat tnsnames.ora tns_alias1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = host1 )(PORT = 1521)) ... (3 Replies)
Discussion started by: ynixon
3 Replies

9. AIX

I cannot find dsn and TNSNAMES.ora on UNIX

Where can I find dsn and TNSNAMES.ora on UNIX AIX Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies

10. Red Hat

Ora-27603:ora-27626:

Hi, User claim that job is running slow from their end. I DBA found in database the below errors in alert log file. ORA-27603: Cell storage I/O error, I/O failed on disk o/192.168.10.3/RECO_DM01_CD_01_drm01 at offset 13335789568 for data length 1048576 ORA-27626: Exadata error: 2201 (IO... (2 Replies)
Discussion started by: Maddy123
2 Replies
sdiff(1)						      General Commands Manual							  sdiff(1)

NAME
sdiff - Compares two files and displays the differences in a side-by-side format SYNOPSIS
sdiff [-l | -s] [-w number] [-o output_file] file1 file2 The sdiff command reads file1 and file2, uses diff to compare them, and writes the results to standard output in a side-by-side format. OPTIONS
Displays only the left side when lines are identical. Creates a third file, output_file, by a controlled interactive line-by-line merging of file1 and file2. The following subcommands govern the creation of this file: Adds the left side to output_file. Adds the right side to output_file. Stops displaying identical lines. Begins displaying identical lines. Enters ed with the left side, the right side, both sides, or an empty file, respectively. Each time you exit from ed, sdiff writes the resulting edited file to the end of output_file. If you fail to save the changes before exiting, sdiff writes the initial input to output_file. Exits the interactive session. Suppresses display of identical lines. Sets the width of the output line to number (130 characters by default). DESCRIPTION
The sdiff command displays each line of the two files with a series of spaces between them if the lines are identical, a < (left angle bracket) in the field of spaces if the line only exists in file1, a > (right angle bracket) if the line only exists in file2, and a | (ver- tical bar) for lines that are different. When you specify the -o option, sdiff produces a third file by merging file1 and file2 according to your instructions. Note that the sdiff command invokes the diff -b command to compare two input files. The -b option causes the diff command to ignore trail- ing spaces, tab characters, and consider other strings of spaces as equal. EXAMPLES
To print a comparison of two files, enter: sdiff chap1.bak chap1 This displays a side-by-side listing that compares each line of chap1.bak and chap1. To display only the lines that differ, enter: sdiff -s -w 80 chap1.bak chap1 This displays the differences at the tty. The -w 80 sets page width to 80 columns. The -s option tells sdiff not to display lines that are identical in both files. To selectively combine parts of two files, enter: sdiff -s -w 80 -o chap1.combo chap1.bak chap1 This combines chap1.bak and chap1 into a new file called chap1.combo. For each group of differing lines, sdiff asks you which group to keep or whether you want to edit them using ed. SEE ALSO
Commands: diff(1), ed(1) sdiff(1)
All times are GMT -4. The time now is 01:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy