This page looks best with JavaScript enabled

How To Extract Details From /etc/oratab on Linux

 ·  ☕ 1 min read

    Ever wanted to parse /etc/oratab but ignore all the comments and blank lines? So did I. Here’s how …

    I can’t claim all the credit for this, it is based on something I was doing plus a bit of “stolen” code from SLES.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    OLDIFS=$IFS
    IFS=:
    grep -v '^\(#\|$\)' /etc/oratab        |\
    while read ORASID ORAHOME AUTOSTART
    do
            ## Do what you like here with
            ##  $ORASID, $ORAHOME and $AUTOSTART ##
    done
    IFS=$OLDIFS
    

    Cheers,
    Norm.

    Share on

    Norman Dunbar
    WRITTEN BY
    Norman Dunbar
    Oracle DBA & developer. (Retired). Now a published book author!