grep -w string
See it in use here
Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies. When relevant, I also write about other technologies, like Linux or PostgreSQL. Many of the posts starts with "how to" since they derive directly from my own personal experience. My goal is to provide simple examples, so that they can be easily adapted to other situations.
_b_tree_bitmap_plans _fast_full_scan_enabled _grant_secure_role _like_with_bind_as_equality _projection_pushdown
for a in $(cat removal_list.txt ); do echo now testing $a sleep 1 curr_param=`grep -w $a init${ORACLE_SID}.ora | awk -F '[=]' '{ print $1 }'` if [ $curr_param ]; then echo removing $curr_param sed -i "/${curr_param}/d" init${ORACLE_SID}.ora sleep 1 else echo $a not found in parameter file. Skipping... sleep 1 fi; done exit 0
chmod 755 remove_params.sh
./remove_params.sh
now testing _b_tree_bitmap_plans removing _b_tree_bitmap_plans now testing _fast_full_scan_enabled removing _fast_full_scan_enabled now testing _grant_secure_role _grant_secure_role not found in parameter file. Skipping... now testing _like_with_bind_as_equality removing _like_with_bind_as_equality now testing _projection_pushdown _projection_pushdown not found in parameter file. Skipping...
sed -i "/_use_column_stats_for_function/d" init.ora
sed -i '7d' myfile.txt
sed -i '7,8d' insert_data.sqlTo delete everything after a specific character, for example #:
sed -i "s/#.*//g" /tmp/autoupgrade.ora
sed -i "s/oldstring/newstring/g"
sed -i "s/11204/12102/g" /etc/oratab
tnsping mydb
OK (10 msec)
TNS-03505: Failed to resolve name
REMOTE_LSNR_STATUS=`cat ${LOG_DIR}/test_tnsping.log | egrep -e 'TNS-|OK' | awk -F '[-(]' '{ print $1 }'`
echo "TABLESPACE REPORT FOR $ORACLE_SID" stty echo echo "All tablespaces or specific tablespace? [A|S]" read answer stty echo case $answer in A|a) echo "All tablespaces selected...please wait..."; getFiles A;; S|s) echo "Which tablespace?"; read wt; getFiles $wt;; *) echo "Only A or S are supported parameters."; exit 1;; esac
############################################################### # Check that the db_convert_file_name and log_file_name_convert # are both set. If not, abort script. ############################################################### TRG_DB=${ORACLE_SID} cat << EoF > check_${TRG_DB}_convert_params.sql set termout off set lines 200 set trimspool on set heading off set pages 0 set feedback off set echo off set verify off col name format a30 col value format a40 spool check_${TRG_DB}_convert_params.lst select name,value from v\$parameter where name in ('db_file_name_convert','log_file_name_convert'); exit EoF sqlplus -s / as sysdba @check_${TRG_DB}_convert_params.sql CONV_DATA_FILE_SET=`cat check_${TRG_DB}_convert_params.lst | grep db_file | awk '{print $2}'` CONV_LOG_FILE_SET=`cat check_${TRG_DB}_convert_params.lst | grep log_file | awk '{print $2}'` case ${CONV_DATA_FILE_SET} in '') echo db_file_name_convert is not set. Correct and retry operation.;exit;; *) echo db_file_name_convert is set. Continuing...;; esac case ${CONV_LOG_FILE_SET} in '') echo log_file_name_convert is not set. Correct and retry operation.;exit;; *) echo log_file_name_convert is set. Continuing...;; esac exit