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.
5 comments:
Just what I was looking for, cheers!!
Good tip,
Saves some time in long run....
Will remember!!
Or just use the excellent vim script at http://www.vim.org/scripts/script.php?script_id=2184
Command was Very helpful.
Thanks !!!
Great ! Always wondered if there were a way to do this but never took time to look for it ... till today.
Glad I did.
Thanks
Post a Comment