fergus wrote: > In any string (eg "xaaabababbbxaabbbabx") remove all instances of "ab" and > keep on doing this as long as you can. > > Do it once: > > echo xaaabababbbxaabbbabx | sed 's/ab//g' > xaabbxabbx
echo xaaabababbbxaabbbabx | sed -e :a -e 's/ab//' -e ta See section 3.7 of the sed manual. The idiom of ":a ... ta" creates a label 'a' and then branches back to that label (repeating the s///) as long as there was a successful match. Brian -- 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/