sed: properly replace lines containing paths via bash script

I am trying to write a bash script that will do backup-based DUPLICATE database (Oracle) from Production to Development host. One of the steps is to take a copy of the Production database pfile, edit it properly and then power-up a new instance on another host. I am having difficulties to do the following on my bash script:

Production pfile: (single line taken as an example, all others are the same)


Let's say that the above line should be changed completely to:


I've had a look at the examples on StackOverflow, but I really can't understand them. Can someone please help me on that?

Many thanks in advance!

EDIT: Thanks a lot guys. This worked out like a charm. Topic Answered.


If it's exactly as you pasted in the question, you can use sed to substitute:

sed -i "s@audit_file_dest='/u01/app/grid/admin/orcl11/adump'@audit_file_dest='/u02/another/path'@" your_file

if you just need to change the single line in your question, @leafei 's line works for you.

if you want to customize your "pfile", like: change



nameB='oldB' #here perhaps you want to keep the old value

you could try this:

awk  'BEGIN{s="\x27";FS=OFS="="}{if($1=="nameA"){print $1,s"newA"s;next;} if($1=="nameC"){print $1,s"newC"s;next;}}1' pfile


kent$  echo "nameA='oldA'
nameC='oldC'"|awk  'BEGIN{s="\x27";FS=OFS="="}{if($1=="nameA"){print $1,s"newA"s;next;} if($1=="nameC"){print $1,s"newC"s;next;}}1'

Need Your Help

cannot update checkbox in php

php mysql

Why can't the data in mysql not updated when I use checkbox, I already tried removing the input type hidden, but still didn't work. I think the problem must be in this part, because when I try to add

Unable to create a model class in Jena Library for Parsing or Extratcting URIS from RDF?XML page

java xml parsing rdf jena

I have wriitten following code using the Jena Library to print the URIs on a web page but it is showing a error. The code is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.