Re: Semi-OT: Vi Question/Need

  • From: William Robertson <william@xxxxxxxxxxxxxxxxxxxx>
  • To: "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Sun, 17 Mar 2013 11:34:16 +0000

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@xxxxxxxxxxxxxxxxxxxx> wrote:

Can't test right now, but should be something like

:%s/\(.\{72\}\(..*$\)/\2


On 15 Mar 2013, at 19:08, "Christopher.Taylor2@xxxxxxxxxxxx"
<Christopher.Taylor2@xxxxxxxxxxxx> 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@xxxxxx]
Sent: Friday, March 15, 2013 1:48 PM
To: Taylor Christopher - Nashville; oracle-l@xxxxxxxxxxxxx
Subject: RE: Semi-OT: Vi Question/Need

You mean <shift>d    delete to end of line  ?


-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of
Christopher.Taylor2@xxxxxxxxxxxx
Sent: Friday, March 15, 2013 9:36 AM
To: oracle-l@xxxxxxxxxxxxx
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.
--
//www.freelists.org/webpage/oracle-l


Other related posts: