Awk to format the files .ora (listener.ora, tnsnames.ora, etc)

Tired of formatting the tnsnames.ora to make it more readable, I have taken the nice awk examples from Jeremy Schneider: https://ardentperf.com/2008/11/28/parsing-listenerora-with-awk-and-sed/ and created a function to format all files .ora (lisp-like config files).

Example, before:

and after:

The AWK script:

I have included the function in the COE github repo. More functions to come (hopefully).

Ludo

The following two tabs change content below.

Ludovico

Principal Product Manager at Oracle
Ludovico is a member of the Oracle Database High Availability (HA), Scalability & Maximum Availability Architecture (MAA) Product Management team in Oracle. He focuses on Fleet Patching and Provisioning (FPP), MAA-optimized database lifecycle management, Cloud MAA and Online Reorganization.

2 thoughts on “Awk to format the files .ora (listener.ora, tnsnames.ora, etc)

  1. Hi Pepe, it’s in the comments in the head of the code…

    # you can source this function in bash and use it like: # cat $TNS_ADMIN/listener.ora | tidy_dotora

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.