Check out the solution at:

http://links.tedpavlic.com/shell_scripts/vimlatex

I implemented the sed scripts with single quotes to help make the 
"trick" documented on that page a little more clear.

The "trick" puts a "\" at the end of the sed script and then inserts a 
NEWLINE right in the middle of the string. The "\" somehow tells the 
shell (or sed) to continue to the next line before assembling the string.

So, really all you need is something like...

sed -e 's/blah/\'$'\n''stuff/'

which will replace "blah" with a newline and then "stuff".

Hopefully that will do it.


Side notes:

1. The OS/X sed has no trouble MATCHING a newline with \n)

2. I changed the ORDER of the search strings. I also added a SECOND 
search string for catching numbers split across lines. It's meant to 
catch lines like:

things 12
34 stuff 56
78 other things

Now, if that pattern continues, it will miss a few. I'm hoping that just 
catching three lines in a row will be sufficient. A better solution 
would be to use perl... but I don't know what's included with OS/X 
without installing the developer tools. :(


Thanks, again --
Ted

Christian Ebert wrote:
> * Ted Pavlic on Friday, March 07, 2008 at 14:39:10 -0500
>> Here's an interesting solution...
>>
>> http://www.culmination.org/2008/02/10/sed-on-mac-os-x-105-leopard/
> 
> Indeed.
> 
>> Use:
>>
>> \\ā€$’\nā€™ā€\
>>
>> instead.
>>
>> I'll make that change and update.
> 
> I'm eager to know how you do it.
> 
> I get
> ": unescaped newline inside substitute pattern
> 
> Also, IIRC, you have to use [0-9][0-9]* instead of [0-9]\+.
> [0-9]\{1,\} works on MacOS, but breaks on other machines.
> 
> c

-- 
Ted Pavlic <[EMAIL PROTECTED]>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Vim-latex-devel mailing list
Vim-latex-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vim-latex-devel

Reply via email to