X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Jerome Fong Subject: Can I use a variable in sed? Date: Thu, 24 May 2007 01:46:46 -0700 Lines: 23 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 Since Shutdown_Port was 9300, I thought the resulting line would be Instead, I got: 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/