Re: Semi-OT: Vi Question/Need
Date: Sun, 17 Mar 2013 11:34:16 +0000
Message-ID: <-7916314630392604266_at_unknownmsgid>
I left out a "\)" (comes of trying to type regexps on the train using an iPad). Also to keep the first pattern rather than the second, that should have been:
:%s/\(.\{72\}\)\(.*\)/\1
i.e: for all lines, find two patterns delimited by \(round brackets\),
where the first is any 72 characters ("." standing for "any character"
and "\{n\}" meaning "repeated n times"), and the second pattern is
anything else up to the end of the line (I originally used "..*$" for
"one or more characters up to end of line" out of habit, but ".*" for
"zero or more characters" does it) - and replace the whole thing with
pattern 1.
Tested using Vim for iPad :)
William Robertson
On 15 Mar 2013, at 19:36, William Robertson <william_at_williamrobertson.net> wrote:
Can't test right now, but should be something like
:%s/\(.\{72\}\(..*$\)/\2
On 15 Mar 2013, at 19:08, "Christopher.Taylor2_at_parallon.net" <Christopher.Taylor2_at_parallon.net> wrote:
Except I wanted to do it in one command through the whole file using search/replace.
Basically, search for cursor postion X, then delete to end of line through each line of the file.
Shift-D requires me to position the cursor using the keys to the cursor position on each line and hit shift-d.
Chris
-----Original Message-----
From: Powell, Mark [mailto:mark.powell2_at_hp.com]
Sent: Friday, March 15, 2013 1:48 PM
To: Taylor Christopher - Nashville; oracle-l_at_freelists.org
Subject: RE: Semi-OT: Vi Question/Need
You mean <shift>d delete to end of line ?
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of
Christopher.Taylor2_at_parallon.net
Sent: Friday, March 15, 2013 9:36 AM
To: oracle-l_at_freelists.org
Subject: Semi-OT: Vi Question/Need
What is the simplest way to delete from a line POSITION to end of line through the whole file? The piece I can't figure out is to start the delete/strip portion at a specific line position on a line. Here's what I'm looking at:
At Id0 (line 4) I want to strip everything from position 73 (the 4th PIPE to end of line). I can't seem to find the right combo of search/replace.
(The reason for doing this is I can strip that off for 2 plans and then compare the plans using WinMerge to quickly id the diffs.
-- http://www.freelists.org/webpage/oracle-lReceived on Sun Mar 17 2013 - 12:34:16 CET