This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Can I use a variable in sed?


I'm trying to write a script that allows me to change the port number depending on when environment I'm in. I can pass in the port number to my script, but I stuck trying to get sed modify my file with my port number variable. Here is the line I'm executing

sed '1,$ s^8080^$Shutdown_Port^' <./temp.xml >./server.xml

Since my line started out to be
<Server port="8005" shutdown="SHUTDOWN">

Since Shutdown_Port was 9300, I thought the resulting line would be

<Server port="9300" shutdown="SHUTDOWN">

Instead, I got:

<Server port="$Shutdown_Port" shutdown="SHUTDOWN">

What am I doing wrong here? Can sed be passed a variable?

thanks,

Jerome


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]