Monday, October 26, 2009
Question: In vi editor, how can I find or locate the nth occurrence of a particular search pattern ?
Answer: With new vim editor, once you search a pattern say /queryname , type 4n in command mode which will leap to the 4th occurrence of the word 'queryname' from where you are.
So to find or locate the 10th occurrence of a particular pattern, go to the top of the file (:1), search for the pattern (/pattern) and then in command mode type 10n.
© Jadu Saikia www.UNIXCL.com