On 9/13/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote:
Yakov Lerner wrote: > On 9/13/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote: >> Yakov Lerner wrote: >> > On 9/13/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> >> >> I'm trying to delete several lines from the beginning of file till >> the >> >> appearance of a specific pattern, without deleting the pattern. I >> have >> >> used the following command: >> >> >> >> :1,/Citations: /d/e-10 >> >> >> >> but the offset doesn't work. >> > >> > Try this: >> > >> > :1,/Citations: /-1d >> > >> > Caution: This works except in the case when pattern is found in the >> > 1st line. >> > >> > Yakov >> > >> > >> That's work fine, thanks! >> >> Can I ask another question? How can someone substitute or delete a block >> of text which expands to more than one line? E.g. the text: >> >> Morning bgfn nbgfn............................more text.. >> ........more text............... >> ....................... end of text. >> >> Can I use a sth like this? >> >> s/Morning,text/anothertext > > try > :s/Morning\_.*text/anothertext/ > or > :s/Morning\(\n\|.\)*text/anothertext/ > > :help \_ > Yakov > > Sorry, that works but I forgot to mention that I have many occurrences of /text/ (last word in block) and I want to substitute to the first occurrence only.
Then you change * in the pattern for \{-} Yakov