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

 
 Home
 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
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

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

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

Using sed in UNIX - global changes to strings
Oracle Tips by Burleson Consulting

 

Using sed in UNIX

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.

chg_all.sh
#!/bin/ksh

tmpdir=tmp.$$

mkdir $tmpdir.new

for f in $*
do
sed -e 's/oldstring/newstring/g' < $f > $tmpdir.new/$f
done

# Make a backup first!
mkdir $tmpdir.old
mv $* $tmpdir.old/

cd $tmpdir.new
mv $* ../

cd ..
rmdir $tmpdir.new


The above is an excerpt from the "Oracle9i UNIX Administration Handbook" by Oracle press, authored by Donald K. Burleson.

 

 

 

��  
 
 
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.