On Tue, Aug 08, 2006 at 05:16:18PM -0400, Seth Dillingham wrote:
> On 8/8/06, Ronald J Kimball said:
>
> > perl -pi -e 's/(.*)/($1)/g' test.txt
>
> OK, that one's even weirder than what BBEdit produces. ;-)
Hehe! That's true.
Given this input:
foo
bar
It produces this output:
(foo)()
()(bar)()
()
This happens because it's reading one line at a time. The regex matches
the word, then the empty string before the newline, then the empty string
*after* the newline.
If you have it read in the whole input as one string you'll get the
same behavior that occurs in BBedit:
perl -pi -e 'BEGIN { $/ = undef } s/(.*)/($1)/g' test.txt
Ronald
--
------------------------------------------------------------------
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]>