#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    11
    Rep Power
    0

    Question linux scripting - linux + oracle + sqlplus + awk, script doesn't work


    Hi all,

    We get log_id value empty after migration.

    Code:
    log_id=$(sqlplus -s /nolog <<-EOF|awk 'NR==2 {print $1}'
      set head off
      set feed off
      set pagesize 0
      conn $DBCONN_AUDIT
      select pls_audit.get_id_log from dual;
    #EOF)
    Maybe (I'm not sure) the problem is in awk.
    Last time we had problem with
    Code:
    awk -F\t
    and changed it to
    Code:
    awk '-F\t'
    (works great).

    Please someone comment is it problem in awk syntaxis and how to solve.
    Thanks ahead.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    11
    Rep Power
    0
    This way it works fine:
    echo -e "conn user1/pass1@plspro\nselect pls_audit.get_id_log from dual;" | sqlplus -s /nolog

    GET_ID_LOG
    ----------
    33363309
    So I guess it is not Oracle question, it is more linux question about syntaxis...

    Maybe someone can kindly help please?

IMN logo majestic logo threadwatch logo seochat tools logo