Showing posts with label shell scripting. Show all posts
Showing posts with label shell scripting. Show all posts

Wednesday, August 31, 2016

Rename filenames and Update database with replace function

echo "Change directory to /app/product/fileupload"
cd /app/product/fileupload
for f in *\ *; do mv "$f" "${f// /_}"; done
echo "complete space removal"

for f in *\:*; do mv "$f" "${f//:/_}"; done
echo "complete semi-colon removal"
cd -
echo "completed"

#!/bin/bash
#/temail="`cat dmvCheckDis`"
export ORACLE_HOME=/opt/app/oracle/product/11.2.0/client_1
$ORACLE_HOME/bin/sqlplus -s puser/passwrd@dbname << ENDOFSQL
set heading off
set linesize 1000
set pagesize 1000
set echo off
alter session set current_schema=siebel;
update SIEBEL.S_SR_ATT set file_name=replace(replace(file_name,' ','_'),':','_'), file_src_path=replace(replace(file_src_path,' ','_'),':','_') where file_name like 'WEB%' and (file_name like '% %' or file_name like '%:%');
commit;
exit;
ENDOFSQL