X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org X-IronPortListener: Outbound_SMTP From: "Buchbinder, Barry (NIH/NIAID) [E]" To: "cygwin AT cygwin DOT com" Date: Fri, 26 Nov 2010 10:14:55 -0500 Subject: RE: Portable Cygwin: replacing drivename in a text file Message-ID: <0105D5C1E0353146B1B222348B0411A209B79592DA@NIHMLBX02.nih.gov> References: <4CEE6175 DOT 2030805 AT bonhard DOT uklinux DOT net> <4CEE64C5 DOT 2080007 AT gremwell DOT com> <4CEE6FAF DOT 5080405 AT arcor DOT de> <4CEE742C DOT 2060305 AT gremwell DOT com> In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 Andrew DeFaria sent the following at Thursday, November 25, 2010 10:15 AM > On 11/25/2010 09:35 AM, Alexandre Bezroutchko wrote: >>> you can use a different separator in the sed command. >>> You can use the following line >>> >>> echo 123 | sed "s%2%${HOME}%g" >> >> Right, this will work in most cases. But will fail if $HOME happens to >> contains % sign. >> The version I have suggested in the previous post is more robust. > >How often does that happen? Use a character that is either or highly unlikely or forbidden to be in a f= ile name. Like < or >. echo 123 | sed "s>2>@$HOME@>g - Barry Disclaimer: Statements made herein are not made on behalf of NIAID. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple