Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vi question 1

Status
Not open for further replies.

kasparov

Programmer
Feb 13, 2002
203
GB
If I do this:

:1,$s/ *//

It deletes the first instance of (any number of) repeated spaces on any line in my file.

Is there a way to say "delete the first instance of 10 (only) repeated spaces" on a line? (Without doing

:1,$s/ //

- i.e. just entering 10 spaces). I'd like to do this for sometimes 40 or more spaces & I'm likely to miscount my spaces!

Thanks, Chris

 
Try
Code:
:%s/ {10}//
P.S. I haven't tested it, but it should work.

Ceci n'est pas une signature
Columb Healy
 
Columb - Unfortunately it doesn't work (for me anyway).

I'm actually working in Vim but could FTP the file to Unix if I needed to. In Vim I get:
E486: Pattern not found: {10}

On my Solaris box (running ksh) I get:
Substitute pattern match failed.

Any other ideas? You've given me something to go on though & I'll search for solutions.

Thanks, Chris
 
Hmm...
I was asuming that the sed commands would translate to vi, obviously they don't in this case.
Ah.. got it
Code:
%s/ \{10\}//
Tested on vi on AIX 4.3

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top