Hi,

Nikolaos A. Patsopoulos wrote:
> 
> I want to join all lines that are inside a given pattern and occurs more 
> than once  in the text, ie:
> 
> ....
> PatternStart ....
> ....text1
> ....text2
> ...text3
> ..text4
> PatternEnd
> ...
> ...
> 
> 
> PatternStart ....
> ....text1
> ....text2
> ...text3
> ..text4
> ...
> ...textn
> PatternEnd
> ....
> 
> 
> ...
> PatternStart ........text1....text2...text3..text4PatternEnd
> ....
> ....
> 
> PatternStart ........text1....text2...text3..text4...    ...textnPatternEnd
> ....
> 
> 
> I tried to use:
> :g/PatternStart\_.\{-}PatternEnd/ J
> 
> but this joins only first and second line of the pattern.
> 
> How can I tell vi to join all lines inside all occurrences of this 
> pattern with variable containing lines?

the pattern you supplied only specifies a single line range. If you want
to join a whole block you must give a start address and an end address,
e.g.

  :g/PatternStart/,/PatternEnd/j

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

Reply via email to