On Fri, Mar 31, 2006 at 11:29:40AM +1100, Steven Heimann wrote: > Unfortunately sed seems to be putting the 2 trailing ** at the beginning > of the replacement line rather than the end of the line and after much > stuffing around I still can't work out what is going wrong.
Works for me: echo '**1.** Scope' | sed "s/^\(\*\*[0-9][. ]\)\*\*\(.*\)$/\1\2**/" **1. Scope** > If I leave out the $ in the regex to match then I get ^M embedded into > the replacement string i.e "**1. Scope^M**" > > Can anyone see what I am doing wrong? Maybe you have DOS end-of-lines in the file; i.e. ^M s Matt -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html