At 12:00 PM -0400 2007/08/21, Ronald J Kimball wrote:
On Tue, Aug 21, 2007 at 11:27:46AM -0400, Chris Pepper wrote:
        I believe BBEdit can do this, but I have been unable to parse
 the answer out of "Conditional Subpatterns" in the Help's "Searching
 with Grep", and suspect it's simple for folks here. I need to unwrap
 configuration stanzas for a Big-IP load balancer. I want to perform
 either one of 2 transformations:

 a)     If the last character on a line *is not* '}': remove the next return.
 b)     If the last character on a line *is* '}': leave the return,
 and add 'b ' before the next line.

        I think Search For should be '(.)\r', but I haven't been able
 to gin up a suitable Replace With.

Conditional Subpatterns are for doing conditional matching, but what you
actually want is conditional *replacement*, which is not something you can
do with a simple grep.

Bummer. I don't want two actions, and I am not particularly concerned with extra line breaks; this is a file of snippets I selectively paste into a shell.

I went with a 2-step Text Factory (I already had one, but the revised one is better):

        GREP:
([^}]) *\r *
\1

        No GREP:
}\r
}\r\rb


                                                Thanks, all!


                                                Chris
--
Chris Pepper:                <http://www.reppep.com/~pepper/>
                             <http://www.extrapepperoni.com/>
The Rockefeller University:  <http://www.rockefeller.edu/>

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to