I have pdb_lists.log as follows:
cat pdb_lists.log
'PDB1','PDB2' 
I need to check TDE status of each PDB from above list and assign to new variable
 for i in $( cat $SQL_SPOOL_LOG_DIR/pdb_lists.log | sed "s/,/ /g" | sed "s/'/ /g")
        do
 PDB_TE_STATUS=$ORACLE_HOME/bin/sqlplus '/as sysdba' << EOF 
            whenever sqlerror exit failure
            connect / as sysdba
            set head off
            set pagesize 0
            set linesize 145
            set feedback off
            alter session set container=$i;
    show con_name;
            spool $SQL_SPOOL_LOG_DIR/pdb_te_enable_status.log
            select status from v\encryption_wallet;
            spool off
 EOF
 CDB_CREATOR_PDB=$ORACLE_HOME/bin/sqlplus '/as sysdba' << EOF 
            whenever sqlerror exit failure
            connect / as sysdba
            set head off
            set pagesize 0
            set linesize 145
            set feedback off
            alter session set container=$i;
    show con_name;
            spool $SQL_SPOOL_LOG_DIR/pdb_cdb_creator_pdb_status.log
            select distinct CREATOR_PDBNAME from v\$encryption_keys where CREATOR_PDBNAME not like 'CDB$ROOT%' and KEY_ID is not null;
            spool off
  EOF
  done
Once I have a new variable assigned for each PDB, then I need run based on the value to respective sql.
 
     
    