Ok thanks.. Definitely not home work.. I am working and this is what i wrote
runsql_analyze_db() {
echo "I am in runsql_analyze_db and the parameter is $1"
statement=$1
echo " The process id in SQL is $$"
echoLog "$statement started at `date`"
sqlResult=`$BINDIR/sqlplus -s <<SQL
######/#######
WHENEVER SQLERROR exit 10
set feedback off
set heading off
set pagesize 100
exec dbms_stats.gather_table_stats($statement
exit
SQL
`
echo "SQL RESULT is $sqlResult"
echoLog "Completed at `date`"
checkORA "$sqlResult" $2
}
submit()
{
chk_process=1
stmt1="update analyze_table set status = NULL;"
echo " The process id in submit is $$"
echo "Now i am in submit"
for collect_stat in `$BINDIR/sqlplus -s <<EOF
xchtbl/xchtblint3
set heading off
set feedback off
set linesize 132
set pagesize 100
select 'ownname=>''' || owner
||''',tabname=>''' || table_name
||''',granularity=>''' || granularity
||''',cascade=>' || cascade
||',method_opt=>''' || NVL(method_opt,'''')
||');'
from analyze_table;
exit
EOF
`
do
I am planning to take the table name from above and fetch rest of the records in the SQL plus to analyze a table. I am running out of ideas.
-F take only character in standred awk. Some advance version can take regexp as argument to -F
You can use an another (may be ugly) approach
echo "GANESH||TEST||MIST" | awk --posix ' {
split($0, a, /\|\|/) ;print a[1]" "a[2]" "a[3]" "a[4]}'
May be you have not looked and tried my last post before posting this.
Atleast care to look for posts carefully before posting a new post.
One more thing enclose your string in "". like echo "string" | awk......