Insert a NEWLINE character.

Gerald Combs gerald at ethereal.com
Tue Sep 3 13:13:13 CDT 2002


On Mon, 2 Sep 2002, Aravind Gottipati wrote:

> Hi,
> 
>     This works in vim, not sure about other vi flavours.
> 
> %s/^REF/<CR>REF/

I'm not sure the '^' would work.  If I understand Jonathan's message
correctly, the line breaks were stripped, e.g. there's just the One Big
Line. The '^' would match one instance of REF only if it were at the
beginning of the line.  Also, you need to add a 'g' at the end of the
sequence to match the multiple instances of REF on the line.  AFAIK, the
official, guaranteed-to-work-in-all-vi-versions way to insert control
characters is to type <CTRL>-V before typing the control character.  This
leaves us with the sequence

    : % s / R E F / <CTRL>-V <CTRL>-M R E F / g

which should display

    :%s/REF/^MREF/g

> This should work in most vi's
> 
> %s/^REF/REF/
> 
> thats a CTRL-M
> 
> HTH
> aravind
> 
> sometime around Mon, Sep 02, 2002 at 08:35:36PM -0500
> Jonathan Hutchins wrote:
> > Ok, I have a text file where the line breaks got stripped, but each line
> > that needs to break begins with the same sequence.  How do I tell vi "find
> > 'REF' replace with '<CR>REF'?
> > 
> > 
> 
> -- 
> Let me put it this way: today is going to be a learning experience
>                                            -- Anonymous
>                                              (seen on slashdot)
> 
> 
> 




More information about the Kclug mailing list