I have a bunch of test files with lines of the form 

**1.** Scope

or 

**2.2** Uniforms and other clothing worn in the production area must be
laundered regularly. Additional clothing changes may be required when
significant soiling occurs, especially when involved in 'dirty' cleaning
or maintenance.

The ones that have no digit after the decimal place I want to change to
the form 

**1. Scope**

I wrote the following

 sed -i.bak "s/^\(\*\*[0-9][. ]\)\*\*\(.*\)$/\1\2**/" *.txt

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.

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?

Thanks for your help
Steven

-- 
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