On 9/14/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote> Yakov Lerner wrote:
> On 9/14/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote: >> Yakov Lerner wrote: >> > On 9/14/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote: >> >> Yakov Lerner wrote: >> >> > On 9/14/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote: >> >> >> 2.Can I delete after a pattern search? Sth like this: >> >> >> >> >> >> :/^<html\_.{-}<body>: /-3d >> >> >> >> >> >> and how can I repeat this globally? >> >> > >> >> > :g/^<html\_.{-}<body>: /.-3d >> >> > >> >> > Yakov >> >> > >> >> > >> >> I get an E16: invalid range error >> > >> > Yeah, this can happen if pattern is found >> > in line number < 4. (Then .-3 results in <=0 which is invalid >> > line number). Just insert 4 dummy empty lines >> > at beginning of file to avoid this. >> > >> > Yakov >> > >> > >> This means that the -3d counts from the beginning of the pattern?? In my >> file The first occurrence of the patten expands from line 1 to line 82. > > Yes, from the beginning of the pattern > > Yakov > > How can I force it to delete 3 lines from the end?
This is tricky, but try this: :g/pattern/exe "normal //e"|.-3d (untested) Yakov