Re: vi question

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

 



On 14Jul2010 21:33, Sjoerd Mullender <sjoerd@xxxxxxx> wrote:
| On 2010-07-14 21:19, Michael Hennebry wrote:
| > On Wed, 14 Jul 2010, Sjoerd Mullender wrote:
| >> On 2010-07-14 19:26, Mike Wright wrote:
| >>> Will somebody tell me the symbol to use for a linefeed in substitutions
| >>>   as in
| >>> 	:s1,$#</tag>#</tag>linefeed#g
| >>
| >> Type control-V control-M.
| > 
| > That would be carriage return.
| > convrol-V control-J might work.
| > You might not be able to substitute a linefeed with vi.
| > I think sed can do it.
| 
| I know it's a carriage return.  Did you try it?  If not, do.  Linefeed
| (control-J) doesn't work.

He hasn't tried it, or he'd know it is The Way.

Mike, vi turns a literal carriage return in a substitution into a
linefeed for you. I use this all the time; Sjoerd's suggestion is
exactly what you want.

BTW, you know you can use "%" for 1,$ ?
And "&" for the text matched by the whole pattern?
The former is just convenient, but the "&" thing is very handy with big
(or varying) patterns.

  :%s#</tag>#&^V^M#g

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Nope. First, you need to learn how to use vi, the editor from hell
(vi vi vi -- the number of the beast), ...
        - Dan Sorenson, DoD#1066, <z1dan@xxxxxxxxxxxxxxxxx>
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux