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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching for "/" Character in Vi 1

Status
Not open for further replies.

jmarkus

Technical User
Joined
Oct 15, 2002
Messages
124
Location
CA
I want to delete every thing up to the last "/" character in vi.

I want to use the command :d//, where the first "/" means find and the second "/" means that character. Obviously that doesn't work. How do I tell it to find the "/" character?

Thanks,
Jeff
 
I want to delete every thing up to the last "/" character in vi
:s!.*/!!
Anyway, man vi.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Sorry,

First, I should have said "I want to delete everything in a line up to the last "/" character.

Second, I want to do it interactively, but repeatedly. That is to say, press "." and have it do it again.

e.g. If I want to delete 5 lines at a time I use "5d", for the next 5 I use "." Sometimes I need to move my cursor down a few lines and skip a few. Then I press "." again and magically 5 more lines get deleted.

Same concept, but with d up to "/" is what I'm looking for.

Thanks,
Jeff

P.S. I have tried man vi, but I couldn't figure out how to do this from the man page.
 
Depending of you will get rid of the / or not, try either
df/
or
dt/
(Without the initial : command mode)

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top