[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: <nl> searchs in vi



Frank Kujawski <frank kujawski org> writes:

> Try this
> :1,$s/^TARGET/^MTARGET/
> ^M needs to be typed as ^V^M
> When you type a ^V you will see a ^, then type ^M and you will see the M
> you can backspace and it will erase both characters.
> 
> ^V can be used in this way in other areas, but that is not todays question...
>           Frank
> 
> dsavage peaknet net wrote:

You've hit on a problem that is really a long standing problem with
sed and new line.  Not saying it can't be done.  But I'm pretty sure
it would take some more scritping than the common %s/string1/string2/.

Probably easier done with awk by piping the buffer thru it like this:

:%! awk '/^TARGET/{print $0"\n";next}{print}'





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]