|
From: | Thomas Dickey |
Subject: | Re: [vile] Is there something special about J[oin], or "why can't I do this?" |
Date: | Tue, 19 Aug 2008 09:18:10 -0400 (EDT) |
On Tue, 19 Aug 2008, Chris G wrote:
I have a file which has a series of CRLF sequences in that I want to change to a comma followed by a space. When viewed in vile (as expected) the CRs appear as ^M so it seemed to me that if I execute (on the command line, i.e. after entering :) the following:- g/ /J I should get what I want. However it doesn't work, vile doesn't seem to accept the J, it just echoes it and then refuses to accept any more input. Why isn't J acceptable there and, more to the point, how can I do what I want to do?
control/J (newline _is_ special). At the moment, there's no way to incorporate it in vile's regular expressions. That's one way that one
could go - regular vi doesn't do this either, but vim does... Another way (which is in regular vi, not in vile) is the ability to combine the commands (my jargon isn't good here - someone may help). Essentially, in regular vi one can do something along the lines of :g/^M/jto join things and modify them at the same time. You can do that in vile - not quite as expressive.
So :g/^M/j :%s/^M\(.\)/, \1/g seems to work. -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net
[Prev in Thread] | Current Thread | [Next in Thread] |