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

Jump to line xx in vi - how? 2

Status
Not open for further replies.

BIS

Technical User
Jun 1, 2001
1,893
NL
Could somebody quickly tell me how to jump to a specific line using vi?
Many thanks in advance.
 
I don't quite get it....

Prss escape, then :, then g23 to jump to line 23?
 
I must be overtly stupid this morning, but I can't get it to work..
I press :g23 (and this appears at the buttom), but all I get is :
Usage: [line [,line]] g[lobal][!}]....

What am I doing wrong?
 
I knew it had to be simple - boy, do I feel silly.

Many thanks Ken, and happy holidays.

[santa]
 
Now I'm confused - I get to a particular line this way:

<line number>G

(ie an upper case G after the line number) No need to press : here. I tried Ken's suggestion but it doesn't work for me - what's happening?
 
Not sure - both methods work for me. Something to do with terminal emulation? I'm on Solaris - possibly some difference in implementation? Confused? I know I am! Cheers.
 
Wasn't it Descartes who said &quot; I think, therefore I am confused&quot; ?

(please don't correct me - just a joke)...

:)
 
I always thought it was 'I drink therefore I am' !

Copyright Monty Python I imagine, but what the!
 
23G to go to line 23 works for me Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884
 
Hi,
I simply type

:23<enter>

Does that only work on SUN's version of VI?
 
It certainly does. As always, there's more than one way to skin a cat in *nix. Have a good Christmas!
 
Even simpler

:23<cr> Jumps to line 23

Also :set nu<cr> turns on line numbering

Happy Xmas :¬)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top