Wednesday, February 13, 2008
9:53 AM

Super Fast way to open a file for vi at a given line

Sometimes, you know the line you want to edit in a file, and you just need to open the file and get to that line. For example, you just had done a grep -n, and found the line you want, say line 99 of a file.

Sure, you can vi the file, and then type 99G (capital G, that is), to get there.

A much faster way is enter this in the command prompt:

$ vi +99 some-file

The above opens some-file and go immediately to line 99.


StumbleUpon Toolbar

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.