>>>>> "unauthorized" == unauthorized  <[EMAIL PROTECTED]> writes:

unauthorized> On Sun, 2 Apr 2006 17:31:33 +1000 Peter Chubb
unauthorized> <[EMAIL PROTECTED]> wrote:

>> >>>>> "Simon" == Simon Bowden <[EMAIL PROTECTED]> writes:
>> 
Simon> On Fri, 31 Mar 2006, Steven Heimann wrote:
>> >> **1. Scope**
>> >> 
>> >> I wrote the following
>> >> 
>> >> sed -i.bak "s/^\(\*\*[0-9][. ]\)\*\*\(.*\)$/\1\2**/" *.txt
>> 
>> The $ will be interpreted by the shell, because it's in double
>> quotes.  Depending on what shell you're using the backslashes could
>> also be swallowed.  You need to use single quotes for most shells.

unauthorized> I know this might be off topic a bit but...  I would
unauthorized> definitely say it depends on your shell as to whether or
unauthorized> not the "$" will be interpreted.

In this particular case it's OK, because the character following the $
isn't part of a valid shell variable.  In the general case, I'd always
quote dollar signs if they're in a double quoted string, just to be
safe.

As another poster mentioned, the problem that Steven was having was
caused by the ambiguity of line ending when there are carriage returns
as well as line feeds in the file.

--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to