Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 








Linux command to change all values within files in an Oracle directory?

Oracle Database Tips by Donald Burleson

Question: What Linux or UNIX command can I use to change all occurrences of a string within a directory?  Do I use sed, awk, or what?

Answer:  The sed command is used to make global changes to strings in UNIX files.  For example, below we have a utility that will change all strings in a directory from one string to another.  This is sort of a ?change all? utility within UNIX. The format of the sed command is:

sed/oldstring/newstring > new file location
The sed utility always makes a new copy of every file it changes, so special care is required to make an in-place change. Note the sed line in this script where sed changes the old string to the new string in all files in the directory.  Note that this script makes a backup of the files in a tmp sub-directory before issuing the change.

WARNING:  This is a VERY POWERFUL script, not to be used by beginners.  Use this script at your own risk:

1 - copy-paste this script as chg_all.sh on your server in the home directory where you wish to make cascading changes.

2 - Issue a chmod +x chg_all.sh to make it executable.

3 - vi the file and change the oldstring and newstring values.  NOT you can put spaces in the command like so:

  sed -e 's/ 2004 / 2015 /g' < $f > $tmpdir.new/$f

4 - Save the file from vi "<esc> : x" and execute the command:


chg_all.sh is below:


mkdir $tmpdir.new
for f in $*
  sed -e 's/oldstring/newstring/g' < $f > $tmpdir.new/$f
# Make a backup first!
mkdir $tmpdir.old
mv $* $tmpdir.old/

cd $tmpdir.new
mv $* ../
cd ..
rmdir $tmpdir.new


See my notes on Oracle directories here.

If you like Oracle tuning, see the book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.